[英]Spring integration Unzip transformer throws ReplyRequiredException exception
We would like to decompress a byte array using Spring Integration and are experiencing the following exception upon using unzip-transformer: 我们想使用Spring Integration解压缩字节数组,并在使用unzip-transformer时遇到以下异常:
org.springframework.integration.handler.ReplyRequiredException: No reply produced by handler 'org.springframework.integration.handler.MessageHandlerChain#1$child#1' ., and its 'requiresReply' property is set to true.,failedMessage=GenericMessage [payload=byte[327] ... org.springframework.integration.handler.ReplyRequiredException:处理程序'org.springframework.integration.handler.MessageHandlerChain#1 $ child#1'未产生任何答复,并且其'requiresReply'属性设置为true。,failedMessage = GenericMessage [有效载荷=字节[327] ...
This is the .xml blob we are trying to use for this effort: 这是我们尝试使用的.xml Blob:
int-zip:unzip-transformer result-type="BYTE_ARRAY" expect-single-result="true"/>
The equivalent java code using service-activator works fine for decompression: 使用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);
Is there any way to do the same code using unzip-transformer? 有什么办法可以使用unzip-transformer进行相同的代码吗?
GZIPInputStream
... The Spring Integration ZIP doesn't support GZIP, only regular ZIP with entries. GZIPInputStream
... Spring Integration ZIP不支持GZIP,仅支持带有条目的常规ZIP。 That's how you get that exception: 这就是您得到该异常的方式:
if (uncompressedData.isEmpty()) {
if (logger.isWarnEnabled()) {
logger.warn("No data unzipped from payload with message Id " + message.getHeaders().getId());
}
unzippedData = null;
}
Just because the ZipUtil.iterate(InputStream is, ZipEntryCallback action)
has nothing to iterate over GZIP payload. 仅仅因为ZipUtil.iterate(InputStream is, ZipEntryCallback action)
没有要在GZIP有效负载上进行迭代的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.