In this code snippet I want to unzip a gzip body using Camel. According to the 
Camel documentation, no other dependencies are needed apart from camel-core.

Link: 
https://camel.apache.org/components/4.0.x/dataformats/gzipDeflater-dataformat.html#_dependencies


    public static void main(final String[] args) throws Exception {
    try (final CamelContext context = new DefaultCamelContext()) {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                
this.from("direct:test").unmarshal().gzipDeflater().to("seda:test2");
            }
        });
        context.start();
        context.createProducerTemplate().sendBody("direct:test", "this is not 
gzip but it does not matter.");
        Thread.currentThread().join();
    }
}


When I run the code I get this error:

Caused by: java.lang.IllegalArgumentException: Data format 'gzipDeflater' could 
not be created. Ensure that the data format is valid and the associated Camel 
component is present on the classpath
at 
org.apache.camel.reifier.dataformat.DataFormatReifier.createDataFormat(DataFormatReifier.java:279)
at 
org.apache.camel.reifier.dataformat.DataFormatReifier.getDataFormat(DataFormatReifier.java:152)
at 
org.apache.camel.reifier.dataformat.DataFormatReifier.getDataFormat(DataFormatReifier.java:112)
at 
org.apache.camel.reifier.UnmarshalReifier.createProcessor(UnmarshalReifier.java:35)
at 
org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:870)
at 
org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:610)
at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:213)
... 11 more

The error message says I need another dependency, but the Camel documentation 
says I don't need one. How is this supposed to work?


Reply via email to