Over a million developers have joined DZone.

Spring Integration Zip 1.0.0.M1 and Others

Let's look at some Spring integrations, like the Spring Integration Zip 1.0.0.M1 and Zip transformer.

· Integration Zone

Build APIs from SQL and NoSQL or Salesforce data sources in seconds. Read the Creating REST APIs white paper, brought to you in partnership with CA Technologies.

Dear Spring Community,

The Spring Integration team wants to wish you a Happy New Year!

We have been super-busy working on new features and improvements. Here is an overview of our recent activities around Spring Integration and Spring AMQP:

  • We made several maintenance releases of Spring Integration 4.2.x, the most recent being Spring Integration 4.2.4. All other maintenance versions will be released only on demand.
  • Spring Integration 4.3 is planned for this summer. Furthermore, for version 5.0, we started looking more closely at incorporating Reactive Streams into the Framework.
  • Similarly with the Spring AMQP project, the current maintenance version is 1.5.3 and1.6 has been started, too.
  • Spring Integration Java DSL 1.1.1 is available, too. You can find several Java DSL samples in the latest Spring Integration Manual, by the way.
  • Spring Integration Kakfa 1.3 has been released as well with features like:
  • Kafka Native Offest Manager;
  • Sync Producer and ProducerListener callback support;
  • New Brokers discovery for the KafkaMessageListenerContainer;
  • And yes: the High-Level Consumer Adapter has been deprecated.

We are also working on Spring Integration Kafka 2.0 which will be based on Apache Kafka 0.9.

Spring Integration Zip

Today we are pleased to announce that the Spring Integration Zip 1.0.0.M1 is now available from the Milestone Repository.

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: FileStringbyte[] 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.

It is easy to configure the Zip Transformer with XML components:

<int-zip:zip-transformer input-channel="input"

as well as with Java Config:

@Transformer(inputChannel = "input", outputChannel = "output")
public ZipTransformer zipTransformer() {
    ZipTransformer zipTransformer = new ZipTransformer();
    return zipTransformer;

UnZip Transformer

The logic implemented in the uncompression component is similarly straightforward. For the input message payload, the following types are supported: FileString 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.

The config for this component is simple, too:

<int-zip:unzip-transformer input-channel="input"
@Transformer(inputChannel = "input", outputChannel = "output")
public UnZipTransformer unZipTransformer() {
    UnZipTransformer unZipTransformer = new UnZipTransformer();
    unZipTransformer.setWorkDirectory(new File("/usr/tmp/uncompress"));
    return unZipTransformer;

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:

<int:chain input-channel="input" output-channel="out">
    <int-zip:unzip-transformer result-type="BYTE_ARRAY"/>
        <bean class="org.springframework.integration.zip.splitter.UnZipResultSplitter"/>


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!

The Integration Zone is brought to you in partnership with CA Technologies.  Use CA Live API Creator to quickly create complete application backends, with secure APIs and robust application logic, in an easy to use interface.

spring,zip,spring integration,java

Published at DZone with permission of Artem Bilan. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}