ArchiveExtractorCamelApp

Created 2017-05-16 08:24:38.840330

back
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.dataformat.tarfile.TarSplitter;
import org.apache.camel.main.Main;

public class ArchiveExtractorCamelApp {
    public static void main(String... args) throws Exception {
        final Main main = new Main();

        // add routes
        main.addRouteBuilder(new RouteBuilder() {
            public void configure() throws Exception {
                from("file:/tmp/test/in/?autoCreate=true")
                        .unmarshal()
                        // unzip
                        .gzip()
                        // extract each file
                        .split(new TarSplitter())
                        // move to destination
                        .to("file:/tmp/test/out/");
            }
        });

        // run until you terminate the JVM
        System.out.println("Starting Camel, use ctrl + c to terminate the JVM.");
        main.run();
    }
}
back