[英]Spring integration Unzip transformer throws ReplyRequiredException exception
我们想使用Spring Integration解压缩字节数组,并在使用unzip-transformer时遇到以下异常:
org.springframework.integration.handler.ReplyRequiredException:处理程序'org.springframework.integration.handler.MessageHandlerChain#1 $ child#1'未产生任何答复,并且其'requiresReply'属性设置为true。,failedMessage = GenericMessage [有效载荷=字节[327] ...
这是我们尝试使用的.xml Blob:
int-zip:unzip-transformer result-type="BYTE_ARRAY" expect-single-result="true"/>
使用service-activator的等效Java代码可以很好地进行解压缩:
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
GZIPInputStream gzipInputStream;
gzipInputStream = new GZIPInputStream(new ByteArrayInputStream((byte[])
message.getPayload()));
IOUtils.copy(gzipInputStream, byteArrayOutputStream);
byteArrayOutputStream.close();
return new String(byteArrayOutputStream.toByteArray(), Charsets.UTF_8);
有什么办法可以使用unzip-transformer进行相同的代码吗?
GZIPInputStream
... Spring Integration ZIP不支持GZIP,仅支持带有条目的常规ZIP。 这就是您得到该异常的方式:
if (uncompressedData.isEmpty()) {
if (logger.isWarnEnabled()) {
logger.warn("No data unzipped from payload with message Id " + message.getHeaders().getId());
}
unzippedData = null;
}
仅仅因为ZipUtil.iterate(InputStream is, ZipEntryCallback action)
没有要在GZIP有效负载上进行迭代的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.