Re: How does Apache Camel (un)marshal with 'gzipDeflater' work?

2024-02-06 Thread Claus Ibsen
Hi

The doc is outdated, you need to have camel-zip-deflater JAR

On Tue, Feb 6, 2024 at 3:57 PM Quirin Ertl 
wrote:

> 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?
>
>
>

-- 
Claus Ibsen
-
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: How does Apache Camel (un)marshal with 'gzipDeflater' work?

2024-02-06 Thread Andrea Cosentino
I guess it's an error in documentation.

Il mar 6 feb 2024, 15:57 Quirin Ertl  ha
scritto:

> 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?
>
>
>


How does Apache Camel (un)marshal with 'gzipDeflater' work?

2024-02-06 Thread Quirin Ertl
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?