Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.

The Zip Data Format is a message compression and de-compression format. Messages marshalled using Zip compression can be unmarshalled using Zip decompression just prior to being consumed at the endpoint. The compression capability is quite useful when you deal with large XML and Text based payloads. It facilitates more optimal use of network bandwidth while incurring a small cost in order to compress and decompress payloads at the endpoint.

About using with Files

The Zip data format, does not (yet) have special support for files. Which means that when using big files, the entire file content is loaded into memory.
This is subject to change in the future, to allow a streaming based solution to have a low memory footprint.

Options

Option

Default

Description

compressionLevel

null

To specify a specific compression Level use java.util.zip.Deflater settings. The possible settings are 
          - Deflater.BEST_SPEED
          - Deflater.BEST_COMPRESSION
          - Deflater.DEFAULT_COMPRESSION

If compressionLevel is not explicitly specified the compressionLevel employed is Deflater.DEFAULT_COMPRESSION

Marshal

In this example we marshal a regular text/XML payload to a compressed payload employing zip compression Deflater.BEST_COMPRESSION and send it an ActiveMQ queue called MY_QUEUE.

from("direct:start").marshal().zip(Deflater.BEST_COMPRESSION).to("activemq:queue:MY_QUEUE");

Alternatively if you would like to use the default setting you could send it as

from("direct:start").marshal().zip().to("activemq:queue:MY_QUEUE");

Unmarshal

In this example we unmarshal a zipped payload from an ActiveMQ queue called MY_QUEUE to its original format, and forward it for processing to the UnZippedMessageProcessor. Note that the compression Level employed during the marshalling should be identical to the one employed during unmarshalling to avoid errors.

from("activemq:queue:MY_QUEUE").unmarshal().zip().process(new UnZippedMessageProcessor()); 

Dependencies

This data format is provided in camel-core so no additional dependencies are needed.

© 2004-2015 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram