We would like to decompress a byte array using Spring Integration and are experiencing the following exception upon using 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] ...
This is the .xml blob we are trying to use for this effort:
int-zip:unzip-transformer result-type="BYTE_ARRAY" expect-single-result="true"/>
The equivalent java code using service-activator works fine for decompression:
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?
GZIPInputStream
... The Spring Integration ZIP doesn't support GZIP, only regular ZIP with entries. 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.