Available since Camel 2.18.0
The Tar File Data Format is a message compression and de-compression format. Messages can be marshalled (compressed) to Tar Files containing a single entry, and Tar Files containing a single entry can be unmarshalled (decompressed) to the original file contents.
There is also a aggregation strategy that can aggregate multiple messages into a single Tar File.
The Tar File dataformat supports 1 options which are listed below.
In this example we marshal a regular text/XML payload to a compressed payload using Tar File compression, and send it to an ActiveMQ queue called MY_QUEUE.
The name of the Tar entry inside the created Tar File is based on the incoming
If there is no incoming
This route would result in a Tar File named "report.txt.tar" in the output directory, containing a single Tar entry named "report.txt".
In this example we unmarshal a Tar File payload from an ActiveMQ queue called MY_QUEUE to its original format, and forward it for processing to the
If the Tar File has more then one entry, the usingIterator option of TarFileDataFormat to be true, and you can use splitter to do the further work.
Or you can use the TarSplitter as an expression for splitter directly like this
Please note that this aggregation strategy requires eager completion check to work properly.
In this example we aggregate all text files found in the input directory into a single Tar File that is stored in the output directory.
To use Tar Files in your camel routes you need to add a dependency on camel-tarfile which implements this data format.
If you use Maven you can just add the following to your