Spring Integration Zip

Especial thanks to our pal Gunnar Hillert, who initiated and started the work for this extension.

The Spring Integration Zip extension provides compression/uncompression components as you would expect. The “hard” work is done by the AbstractZipTransformer implementations which uses the ZeroTurnaround ZIP Library under the covers. zt-zip provides a convenient, high-level API over the standard java.util.zip package.

With this Milestone 1 the following components are provided:

Zip Transformer

The goal of this component is to zip inbound message payloads and to produce a compressed archive, based on the java.util.zip.Deflater compression level. The following message payload types are supported: File, String, byte[] or Iterable of those types. The result can be returned either as a File or as byte[] of compressed data. This is defined by theZipResultType.

UnZip Transformer

The logic implemented in the uncompression component is similarly straightforward. For the input message payload, the following types are supported: File, String or byte[] and treated as an archive to decompress. When unzipping data, you can also specify a propertyexpectSingleResult. If set to true and more than 1 zip entry were detected, aMessagingException will be raised. This property also influences the return type of the payload. If set to false (the default), then the payload will be of type SortedMap, if true, however, the actual zip entry will be returned.

UnZip Result Splitter

The UnZipResultSplitter can be used as a downstream helper component to produce each unzipped entry as a separate message. The FileHeaders.FILENAME andZipHeaders.ZIP_ENTRY_PATH headers are populated for each splitted item:

Conclusion

This is just the beginning for this extension and any community feedback is very important to us as it helps us to understand what to improve, what should be added or changed. Therefore, do not hesitate to reach out to us via any available channel to share your ideas or to get some help from us!