THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
from("activemq:queue:MY_QUEUE").unmarshal().zipFile().process(new UnZippedMessageProcessor()); |
If the zip file has more then one entry, the usingIterator option of ZipFileDataFormat to be true, and you can use splitter to do the further work.
Code Block |
---|
ZipFileDataFormat zipFile = new ZipFileDataFormat();
zipFile.setUsingIterator(true);
from("file:src/test/resources/org/apache/camel/dataformat/zipfile/?consumer.delay=1000&noop=true")
.unmarshal(zipFile)
.split(body(Iterator.class))
.streaming()
.process(new UnZippedMessageProcessor())
.end();
|
Or you can use the ZipSplitter as an expression for splitter directly like this
Code Block |
---|
from("file:src/test/resources/org/apache/camel/dataformat/zipfile?consumer.delay=1000&noop=true")
.split(new ZipSplitter())
.streaming()
.process(new UnZippedMessageProcessor())
.end();
|
Dependencies
To use Zip files in your camel routes you need to add a dependency on camel-zipfile which implements this data format.
...