Tuesday, September 2, 2014

Decompressing a zip file using Apache Camel Java DSL

Sample route in Java DSL for decompressing a zip file using Apache Camel.
from("file:{{inputDir}}?sortBy=file:name&include=.*.zip&move={{archiveDir}}&delay={{pollDelay}}")
.log("Decompressing file ${file:name}.")
.split(new ZipSplitter())
.streaming().convertBodyTo(String.class) 
.choice()
 .when(body().isNotNull())
     .to("file:{{tempDir}}")
    .end()
.log("Decompressed file name is ${file:name}.")
.end();
Apache Camel is light weight but powerful open source integration framework which supports large variety of integration patterns and transport protocols.

No comments:

Post a Comment