MailConsumer replacing identical filename attachments

2018-06-20 Thread Joery Vreijsen
Hi there!

I’m struggling with the camel-mail consumer, when it reads the MailMessage and 
extracts the multipart attachments.
Looking at the implementation of MailBinding.java I notice that the multipart 
attachments are put in an Map() causing attachments
with the same filename to be overwritten by the Map#put method.

I was wondering if this is a known issue, or something we could possibly fix?

Any advice is welcome!

Greetings,

- Joery Vreijsen


Re: Unexpected Result Split / JsonPath

2018-02-19 Thread Joery Vreijsen
Hi

Will do, thanks again for the quick help!

Cheers,

- Joery

On 19 Feb 2018 15:39 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
> Hi
>
> Thanks so what we can see its that you end up with camel-jms thread
> attempting to load the class which it cannot do
>
> I logged a ticket
> https://issues.apache.org/jira/browse/CAMEL-12278
>
> You are welcome to test the SNAPSHOT build for either master or the
> 2.20.x branch (you can build it yourself, or wait a while until CI
> server publish updated snapshots on ASF snapshot maven repo)
>
>
>
> On Mon, Feb 19, 2018 at 3:08 PM, Joery Vreijsen <jhjvreij...@gmail.com> wrote:
> > Hi,
> >
> > These loggings showed up on installation:
> >
> > 15:03:49.890 INFO [Blueprint Event Dispatcher: 1] Attempting to start Camel 
> > Context ID_5a86a27cc6d58e7b5e01
> > 15:03:49.891 INFO [Blueprint Event Dispatcher: 1] Apache Camel 2.20.1 
> > (CamelContext: ID_5a86a27cc6d58e7b5e01) is starting
> > 15:03:49.927 INFO [Blueprint Event Dispatcher: 1] StreamCaching is enabled 
> > on CamelContext: ID_5a86a27cc6d58e7b5e01
> > 15:03:49.937 INFO [Blueprint Event Dispatcher: 1] MDC logging is enabled on 
> > CamelContext: ID_5a86a27cc6d58e7b5e01
> > 15:03:49.942 INFO [Blueprint Event Dispatcher: 1] JMX is enabled
> > 15:03:49.971 INFO [Thread-86] Sending starting signal..
> > 15:03:50.056 DEBUG [Blueprint Event Dispatcher: 1] Initializing expression 
> > using: $.content
> > 15:03:50.172 DEBUG [Blueprint Event Dispatcher: 1] Compiled static 
> > JsonPath: $.content
> > 15:03:50.175 DEBUG [Blueprint Event Dispatcher: 1] Initializing expression 
> > using: $.content
> > 15:03:50.177 DEBUG [Blueprint Event Dispatcher: 1] Compiled static 
> > JsonPath: $.content
> > 15:03:50.226 INFO [Blueprint Event Dispatcher: 1] StreamCaching in use with 
> > spool directory: tmp/camelcontext-ID_5a86a27cc6d58e7b5e01 and rules: 
> > [Spool > 70% used of Max heap memory]
> > 15:03:50.291 INFO [Blueprint Event Dispatcher: 1] jetty-9.3.21.v20170918
> > 15:03:50.299 INFO [Blueprint Event Dispatcher: 1] Started 
> > o.e.j.s.ServletContextHandler@5e4c54e8{/,null,AVAILABLE}
> > 15:03:50.306 INFO [Blueprint Event Dispatcher: 1] Started 
> > ServerConnector@62e4e21b{HTTP/1.1,[http/1.1]}{0.0.0.0:9000}
> > 15:03:50.312 INFO [Blueprint Event Dispatcher: 1] Started @283167ms
> > 15:03:50.318 INFO [Blueprint Event Dispatcher: 1] Route: 
> > 38c94ee6-565a-4e52-8500-5e9ccca53fff started and consuming from: 
> > jetty:http://0.0.0.0:9000/split/jsonpath?transferException=true
> > 15:03:50.341 INFO [ActiveMQ Task-1] Successfully connected to 
> > tcp://localhost:61616
> > 15:03:50.356 INFO [Blueprint Event Dispatcher: 1] Route: 
> > 28dca82e-1ba4-4ca4-a978-756304c69e2c started and consuming from: 
> > activemq://ID_5a86a27cc6d58e7b5e01_38c94ee6-565a-4e52-8500-5e9ccca53fff
> > 15:03:50.369 INFO [ActiveMQ Task-1] Successfully connected to 
> > tcp://localhost:61616
> > 15:03:50.377 INFO [Blueprint Event Dispatcher: 1] Route: 
> > 64eb9be4-e8fc-4dfa-8270-86e1daf3a15e started and consuming from: 
> > activemq://ID_5a86a27cc6d58e7b5e01_28dca82e-1ba4-4ca4-a978-756304c69e2c_BottomCenter_split
> > 15:03:50.389 INFO [ActiveMQ Task-1] Successfully connected to 
> > tcp://localhost:61616
> > 15:03:50.398 INFO [Blueprint Event Dispatcher: 1] Route: 
> > 8c827be5-1469-4aac-ba42-24eb1da56658 started and consuming from: 
> > activemq://ID_5a86a27cc6d58e7b5e01_28dca82e-1ba4-4ca4-a978-756304c69e2c_split
> > 15:03:50.404 INFO [Blueprint Event Dispatcher: 1] Total 4 routes, of which 
> > 4 are started
> > 15:03:50.408 INFO [Blueprint Event Dispatcher: 1] Apache Camel 2.20.1 
> > (CamelContext: ID_5a86a27cc6d58e7b5e01) started in 0.517 seconds
> >
> > These loggings showed up on triggering the route:
> >
> > 15:04:12.904 DEBUG [Camel (ID_5a86a27cc6d58e7b5e01) thread #5 - 
> > JmsConsumer[ID_5a86a27cc6d58e7b5e01_38c94ee6-565a-4e52-8500-5e9ccca53fff]]
> >  Attempting to enable JacksonJsonAdapter by resolving: 
> > org.apache.camel.jsonpath.jackson.JacksonJsonAdapter from classpath
> > 15:04:12.913 DEBUG [Camel (ID_5a86a27cc6d58e7b5e01) thread #5 - 
> > JmsConsumer[ID_5a86a27cc6d58e7b5e01_38c94ee6-565a-4e52-8500-5e9ccca53fff]]
> >  Cannot writeAsString as adapter cannot be initialised
> >
> > - Joery
> >
> > On 19 Feb 2018 14:53 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
> > > Hi
> > >
> > > Maybe OSGi classloading is wonderful
> > >
> > > Can you turn on DEBUG/TRACE 

Re: Unexpected Result Split / JsonPath

2018-02-19 Thread Joery Vreijsen
Hi,

These loggings showed up on installation:

15:03:49.890 INFO [Blueprint Event Dispatcher: 1] Attempting to start Camel 
Context ID_5a86a27cc6d58e7b5e01
15:03:49.891 INFO [Blueprint Event Dispatcher: 1] Apache Camel 2.20.1 
(CamelContext: ID_5a86a27cc6d58e7b5e01) is starting
15:03:49.927 INFO [Blueprint Event Dispatcher: 1] StreamCaching is enabled on 
CamelContext: ID_5a86a27cc6d58e7b5e01
15:03:49.937 INFO [Blueprint Event Dispatcher: 1] MDC logging is enabled on 
CamelContext: ID_5a86a27cc6d58e7b5e01
15:03:49.942 INFO [Blueprint Event Dispatcher: 1] JMX is enabled
15:03:49.971 INFO [Thread-86] Sending starting signal..
15:03:50.056 DEBUG [Blueprint Event Dispatcher: 1] Initializing expression 
using: $.content
15:03:50.172 DEBUG [Blueprint Event Dispatcher: 1] Compiled static JsonPath: 
$.content
15:03:50.175 DEBUG [Blueprint Event Dispatcher: 1] Initializing expression 
using: $.content
15:03:50.177 DEBUG [Blueprint Event Dispatcher: 1] Compiled static JsonPath: 
$.content
15:03:50.226 INFO [Blueprint Event Dispatcher: 1] StreamCaching in use with 
spool directory: tmp/camelcontext-ID_5a86a27cc6d58e7b5e01 and rules: [Spool 
> 70% used of Max heap memory]
15:03:50.291 INFO [Blueprint Event Dispatcher: 1] jetty-9.3.21.v20170918
15:03:50.299 INFO [Blueprint Event Dispatcher: 1] Started 
o.e.j.s.ServletContextHandler@5e4c54e8{/,null,AVAILABLE}
15:03:50.306 INFO [Blueprint Event Dispatcher: 1] Started 
ServerConnector@62e4e21b{HTTP/1.1,[http/1.1]}{0.0.0.0:9000}
15:03:50.312 INFO [Blueprint Event Dispatcher: 1] Started @283167ms
15:03:50.318 INFO [Blueprint Event Dispatcher: 1] Route: 
38c94ee6-565a-4e52-8500-5e9ccca53fff started and consuming from: 
jetty:http://0.0.0.0:9000/split/jsonpath?transferException=true
15:03:50.341 INFO [ActiveMQ Task-1] Successfully connected to 
tcp://localhost:61616
15:03:50.356 INFO [Blueprint Event Dispatcher: 1] Route: 
28dca82e-1ba4-4ca4-a978-756304c69e2c started and consuming from: 
activemq://ID_5a86a27cc6d58e7b5e01_38c94ee6-565a-4e52-8500-5e9ccca53fff
15:03:50.369 INFO [ActiveMQ Task-1] Successfully connected to 
tcp://localhost:61616
15:03:50.377 INFO [Blueprint Event Dispatcher: 1] Route: 
64eb9be4-e8fc-4dfa-8270-86e1daf3a15e started and consuming from: 
activemq://ID_5a86a27cc6d58e7b5e01_28dca82e-1ba4-4ca4-a978-756304c69e2c_BottomCenter_split
15:03:50.389 INFO [ActiveMQ Task-1] Successfully connected to 
tcp://localhost:61616
15:03:50.398 INFO [Blueprint Event Dispatcher: 1] Route: 
8c827be5-1469-4aac-ba42-24eb1da56658 started and consuming from: 
activemq://ID_5a86a27cc6d58e7b5e01_28dca82e-1ba4-4ca4-a978-756304c69e2c_split
15:03:50.404 INFO [Blueprint Event Dispatcher: 1] Total 4 routes, of which 4 
are started
15:03:50.408 INFO [Blueprint Event Dispatcher: 1] Apache Camel 2.20.1 
(CamelContext: ID_5a86a27cc6d58e7b5e01) started in 0.517 seconds

These loggings showed up on triggering the route:

15:04:12.904 DEBUG [Camel (ID_5a86a27cc6d58e7b5e01) thread #5 - 
JmsConsumer[ID_5a86a27cc6d58e7b5e01_38c94ee6-565a-4e52-8500-5e9ccca53fff]] 
Attempting to enable JacksonJsonAdapter by resolving: 
org.apache.camel.jsonpath.jackson.JacksonJsonAdapter from classpath
15:04:12.913 DEBUG [Camel (ID_5a86a27cc6d58e7b5e01) thread #5 - 
JmsConsumer[ID_5a86a27cc6d58e7b5e01_38c94ee6-565a-4e52-8500-5e9ccca53fff]] 
Cannot writeAsString as adapter cannot be initialised

- Joery

On 19 Feb 2018 14:53 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
> Hi
>
> Maybe OSGi classloading is wonderful
>
> Can you turn on DEBUG/TRACE logging at 
> org.apache.camel.jsonpath.JsonPathEngine
> And see what the logs say
>
>
>
> On Mon, Feb 19, 2018 at 2:41 PM, Joery Vreijsen <jhjvreij...@gmail.com> wrote:
> > Hi Claus,
> >
> > After successfully creating my flow in the Java DSL i was now moving it 
> > across to the Spring DSL running in Karaf.
> > However i kept running into the issue that the JacksonJsonAdapter wasn’t 
> > found on my class path.
> >
> > When i manually exported the 
> > org.apache.camel.jsonpath.jackson.JacksonJsonAdapter in one of my bundles 
> > this however did work.
> >
> > Can it be that this does not get exported (correctly) by the camel-jsonpath 
> > feature?
> >
> > Cheers!
> >
> > - Joery
> >
> > On 19 Feb 2018 10:53 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
> > > Hi
> > >
> > > Thanks for sharing its a jackson issue. Maybe you could try with
> > > 2.9.10 version and see how it works there.
> > >
> > > On Sun, Feb 18, 2018 at 11:50 PM, Joery Vreijsen <jhjvreij...@gmail.com> 
> > > wrote:
> > > > Hi,
> > > >
> > > > Just posting my final findings to this.
> > > > My issue was caused by the fact i was usi

Re: Unexpected Result Split / JsonPath

2018-02-19 Thread Joery Vreijsen
Hi Claus,

After successfully creating my flow in the Java DSL i was now moving it across 
to the Spring DSL running in Karaf.
However i kept running into the issue that the JacksonJsonAdapter wasn’t found 
on my class path.

When i manually exported the 
org.apache.camel.jsonpath.jackson.JacksonJsonAdapter in one of my bundles this 
however did work.

Can it be that this does not get exported (correctly) by the camel-jsonpath 
feature?

Cheers!

- Joery

On 19 Feb 2018 10:53 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
> Hi
>
> Thanks for sharing its a jackson issue. Maybe you could try with
> 2.9.10 version and see how it works there.
>
> On Sun, Feb 18, 2018 at 11:50 PM, Joery Vreijsen <jhjvreij...@gmail.com> 
> wrote:
> > Hi,
> >
> > Just posting my final findings to this.
> > My issue was caused by the fact i was using Jackson 2.9.4 which logged: 
> > Cannot writeAsString as adapter cannot be initialized.
> > When downgrading to 2.8.10 the writeAsString option worked perfectly, 
> > outputting a valid Json string, rather than the Map toString().
> >
> > This might also explain the NoTypeConversionAvailableException.
> >
> > Maybe something to add to the docs ;)
> >
> > Thanks for the help, cheers!
> >
> > - Joery
> >
> > On 16 Feb 2018 16:55 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
> > > Hi
> > >
> > > It looks like your json is invalid / not structured well. You inner
> > > map uses duplicate ids, eg document.
> > > If possible use a array instead, eg [ ]
> > >
> > > See the unit test from the source code - JsonPathSplitWriteAsStringTest
> > >
> > > On Fri, Feb 16, 2018 at 10:44 AM, Joery Vreijsen <jhjvreij...@gmail.com> 
> > > wrote:
> > > > That indeed was my thought aswell, i tried the following route:
> > > >
> > > > from("file:src/data")
> > > > .split().jsonpathWriteAsString("$..document")
> > > > .setHeader(Exchange.FILE_NAME, new 
> > > > SimpleExpression("${exchangeId}.json"))
> > > > .to("file:target/messages/others”);
> > > >
> > > > But this resulted also in the following exception:
> > > >
> > > > No body available of type: java.io.InputStream but has value: 
> > > > {name=document 1, type=pdf} of type: java.util.LinkedHashMap on: 
> > > > Message[]. Caused by: No type converter available to convert from type: 
> > > > java.util.LinkedHashMap to the required type: java.io.InputStream with 
> > > > value {name=document 1, type=pdf}. 
> > > > Exchange[ID-local-1518795550966-0-3]. Caused by: 
> > > > [org.apache.camel.NoTypeConversionAvailableException - No type 
> > > > converter available to convert from type: java.util.LinkedHashMap to 
> > > > the required type: java.io.InputStream with value {name=document 1, 
> > > > type=pdf}]
> > > >
> > > > I tried the route in the Spring DSL, and there the WriteAsString option 
> > > > worked, but outputted the .toString() value of the Map class, e.g. 
> > > > "{name=document 1, type=pdf}”.
> > > > Is there a possibility to let it output a valid json string, or is it 
> > > > just the Map toString function you can get back?
> > > >
> > > > Thanks again.
> > > >
> > > > Cheers!
> > > >
> > > > - Joery
> > > >
> > > > On 16 Feb 2018 16:37 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
> > > > > Ah okay yeah that can make sense to try to tell it to output as
> > > > > String. See the writeAsString option you would need to use
> > > > > https://github.com/apache/camel/blob/master/components/camel-jsonpath/src/main/docs/jsonpath-language.adoc
> > > > >
> > > > >
> > > > >
> > > > > On Fri, Feb 16, 2018 at 10:30 AM, Joery Vreijsen 
> > > > > <jhjvreij...@gmail.com> wrote:
> > > > > > Hi Clause,
> > > > > >
> > > > > > Thanks for the quick response!
> > > > > >
> > > > > > When removing the String.class i get the following exception:
> > > > > >
> > > > > > No body available of type: java.io.InputStream but has value: 
> > > > > > {name=document 2, type=pdf} of type: java.util.LinkedHashMap on: 
> > > > > > Message[]. Caused by: No type converter available t

Re: Unexpected Result Split / JsonPath

2018-02-18 Thread Joery Vreijsen
Hi,

Just posting my final findings to this.
My issue was caused by the fact i was using Jackson 2.9.4 which logged: Cannot 
writeAsString as adapter cannot be initialized.
When downgrading to 2.8.10 the writeAsString option worked perfectly, 
outputting a valid Json string, rather than the Map toString().

This might also explain the NoTypeConversionAvailableException.

Maybe something to add to the docs ;)

Thanks for the help, cheers!

- Joery

On 16 Feb 2018 16:55 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
> Hi
>
> It looks like your json is invalid / not structured well. You inner
> map uses duplicate ids, eg document.
> If possible use a array instead, eg [ ]
>
> See the unit test from the source code - JsonPathSplitWriteAsStringTest
>
> On Fri, Feb 16, 2018 at 10:44 AM, Joery Vreijsen <jhjvreij...@gmail.com> 
> wrote:
> > That indeed was my thought aswell, i tried the following route:
> >
> > from("file:src/data")
> > .split().jsonpathWriteAsString("$..document")
> > .setHeader(Exchange.FILE_NAME, new SimpleExpression("${exchangeId}.json"))
> > .to("file:target/messages/others”);
> >
> > But this resulted also in the following exception:
> >
> > No body available of type: java.io.InputStream but has value: 
> > {name=document 1, type=pdf} of type: java.util.LinkedHashMap on: Message[]. 
> > Caused by: No type converter available to convert from type: 
> > java.util.LinkedHashMap to the required type: java.io.InputStream with 
> > value {name=document 1, type=pdf}. Exchange[ID-local-1518795550966-0-3]. 
> > Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type 
> > converter available to convert from type: java.util.LinkedHashMap to the 
> > required type: java.io.InputStream with value {name=document 1, type=pdf}]
> >
> > I tried the route in the Spring DSL, and there the WriteAsString option 
> > worked, but outputted the .toString() value of the Map class, e.g. 
> > "{name=document 1, type=pdf}”.
> > Is there a possibility to let it output a valid json string, or is it just 
> > the Map toString function you can get back?
> >
> > Thanks again.
> >
> > Cheers!
> >
> > - Joery
> >
> > On 16 Feb 2018 16:37 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
> > > Ah okay yeah that can make sense to try to tell it to output as
> > > String. See the writeAsString option you would need to use
> > > https://github.com/apache/camel/blob/master/components/camel-jsonpath/src/main/docs/jsonpath-language.adoc
> > >
> > >
> > >
> > > On Fri, Feb 16, 2018 at 10:30 AM, Joery Vreijsen <jhjvreij...@gmail.com> 
> > > wrote:
> > > > Hi Clause,
> > > >
> > > > Thanks for the quick response!
> > > >
> > > > When removing the String.class i get the following exception:
> > > >
> > > > No body available of type: java.io.InputStream but has value: 
> > > > {name=document 2, type=pdf} of type: java.util.LinkedHashMap on: 
> > > > Message[]. Caused by: No type converter available to convert from type: 
> > > > java.util.LinkedHashMap to the required type: java.io.InputStream with 
> > > > value {name=document 2, type=pdf}. 
> > > > Exchange[ID-local-1518794941554-0-5]. Caused by: 
> > > > [org.apache.camel.NoTypeConversionAvailableException - No type 
> > > > converter available to convert from type: java.util.LinkedHashMap to 
> > > > the required type: java.io.InputStream with value {name=document 2, 
> > > > type=pdf}]
> > > >
> > > > I was trying to split a Json without getting a Map POJO as return, but 
> > > > rather just a String value.
> > > >
> > > > Cheers,
> > > >
> > > > - Joery
> > > >
> > > >
> > > > On 16 Feb 2018 16:27 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
> > > > > Try without the String.class in the jsonpath
> > > > >
> > > > > On Fri, Feb 16, 2018 at 10:22 AM, Joery Vreijsen 
> > > > > <jhjvreij...@gmail.com> wrote:
> > > > > > Hi,
> > > > > >
> > > > > > I’m trying to split my following Json file with the Camel Splitter 
> > > > > > & JsonPath components.
> > > > > >
> > > > > > [
> > > > > > {
> > > > > > "document": {
> > > > > > "name": "document 1&qu

Re: Unexpected Result Split / JsonPath

2018-02-16 Thread Joery Vreijsen
That indeed was my thought aswell, i tried the following route:

from("file:src/data")
                .split().jsonpathWriteAsString("$..document")
                .setHeader(Exchange.FILE_NAME, new 
SimpleExpression("${exchangeId}.json"))
                .to("file:target/messages/others”);

But this resulted also in the following exception:

No body available of type: java.io.InputStream but has value: {name=document 1, 
type=pdf} of type: java.util.LinkedHashMap on: Message[]. Caused by: No type 
converter available to convert from type: java.util.LinkedHashMap to the 
required type: java.io.InputStream with value {name=document 1, type=pdf}. 
Exchange[ID-local-1518795550966-0-3]. Caused by: 
[org.apache.camel.NoTypeConversionAvailableException - No type converter 
available to convert from type: java.util.LinkedHashMap to the required type: 
java.io.InputStream with value {name=document 1, type=pdf}]

I tried the route in the Spring DSL, and there the WriteAsString option worked, 
but outputted the .toString() value of the Map class, e.g.  "{name=document 1, 
type=pdf}”.
Is there a possibility to let it output a valid json string, or is it just the 
Map toString function you can get back?

Thanks again.

Cheers!

- Joery

On 16 Feb 2018 16:37 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
> Ah okay yeah that can make sense to try to tell it to output as
> String. See the writeAsString option you would need to use
> https://github.com/apache/camel/blob/master/components/camel-jsonpath/src/main/docs/jsonpath-language.adoc
>
>
>
> On Fri, Feb 16, 2018 at 10:30 AM, Joery Vreijsen <jhjvreij...@gmail.com> 
> wrote:
> > Hi Clause,
> >
> > Thanks for the quick response!
> >
> > When removing the String.class i get the following exception:
> >
> > No body available of type: java.io.InputStream but has value: 
> > {name=document 2, type=pdf} of type: java.util.LinkedHashMap on: Message[]. 
> > Caused by: No type converter available to convert from type: 
> > java.util.LinkedHashMap to the required type: java.io.InputStream with 
> > value {name=document 2, type=pdf}. Exchange[ID-local-1518794941554-0-5]. 
> > Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type 
> > converter available to convert from type: java.util.LinkedHashMap to the 
> > required type: java.io.InputStream with value {name=document 2, type=pdf}]
> >
> > I was trying to split a Json without getting a Map POJO as return, but 
> > rather just a String value.
> >
> > Cheers,
> >
> > - Joery
> >
> >
> > On 16 Feb 2018 16:27 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
> > > Try without the String.class in the jsonpath
> > >
> > > On Fri, Feb 16, 2018 at 10:22 AM, Joery Vreijsen <jhjvreij...@gmail.com> 
> > > wrote:
> > > > Hi,
> > > >
> > > > I’m trying to split my following Json file with the Camel Splitter & 
> > > > JsonPath components.
> > > >
> > > > [
> > > > {
> > > > "document": {
> > > > "name": "document 1",
> > > > "type": "pdf"
> > > > }
> > > > },
> > > > {
> > > > "document": {
> > > > "name": "document 2",
> > > > "type": "pdf"
> > > > }
> > > > }
> > > > ]
> > > >
> > > > The route I’m using looks like this:
> > > >
> > > > from("file:src/data")
> > > > .split().jsonpath("$..document", String.class)
> > > > .to("file:target/messages/others");
> > > >
> > > > I expected two output files with contents similar to this:
> > > >
> > > > "document": {
> > > > "name": "document 1",
> > > > "type": "pdf"
> > > > }
> > > >
> > > > Strangely enough i got 4 output files with the following content:
> > > >
> > > > file 1: [{"name":"document 1"
> > > > file 2: "type":"pdf"}
> > > > file 3: {"name":"document 2"
> > > > file 4: "type":"pdf"}]
> > > >
> > > > Am i doing something wrong with my JsonPath? Any help is very much 
> > > > appreciated!
> > > >
> > > > Cheers,
> > > >
> > > > - Joery
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -
> > > http://davsclaus.com @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


Re: Unexpected Result Split / JsonPath

2018-02-16 Thread Joery Vreijsen
Hi Clause,

Thanks for the quick response!

When removing the String.class i get the following exception:

No body available of type: java.io.InputStream but has value: {name=document 2, 
type=pdf} of type: java.util.LinkedHashMap on: Message[]. Caused by: No type 
converter available to convert from type: java.util.LinkedHashMap to the 
required type: java.io.InputStream with value {name=document 2, type=pdf}. 
Exchange[ID-local-1518794941554-0-5]. Caused by: 
[org.apache.camel.NoTypeConversionAvailableException - No type converter 
available to convert from type: java.util.LinkedHashMap to the required type: 
java.io.InputStream with value {name=document 2, type=pdf}]

I was trying to split a Json without getting a Map POJO as return, but rather 
just a String value.

Cheers,

- Joery


On 16 Feb 2018 16:27 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
> Try without the String.class in the jsonpath
>
> On Fri, Feb 16, 2018 at 10:22 AM, Joery Vreijsen <jhjvreij...@gmail.com> 
> wrote:
> > Hi,
> >
> > I’m trying to split my following Json file with the Camel Splitter & 
> > JsonPath components.
> >
> > [
> > {
> > "document": {
> > "name": "document 1",
> > "type": "pdf"
> > }
> > },
> > {
> > "document": {
> > "name": "document 2",
> > "type": "pdf"
> > }
> > }
> > ]
> >
> > The route I’m using looks like this:
> >
> > from("file:src/data")
> > .split().jsonpath("$..document", String.class)
> > .to("file:target/messages/others");
> >
> > I expected two output files with contents similar to this:
> >
> > "document": {
> > "name": "document 1",
> > "type": "pdf"
> > }
> >
> > Strangely enough i got 4 output files with the following content:
> >
> > file 1: [{"name":"document 1"
> > file 2: "type":"pdf"}
> > file 3: {"name":"document 2"
> > file 4: "type":"pdf"}]
> >
> > Am i doing something wrong with my JsonPath? Any help is very much 
> > appreciated!
> >
> > Cheers,
> >
> > - Joery
> >
> >
> >
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


Unexpected Result Split / JsonPath

2018-02-16 Thread Joery Vreijsen
Hi,

I’m trying to split my following Json file with the Camel Splitter & JsonPath 
components.

[
  {
    "document": {
      "name": "document 1",
      "type": "pdf"
    }
  },
  {
    "document": {
      "name": "document 2",
      "type": "pdf"
    }
  }
]

The route I’m using looks like this:

from("file:src/data")
    .split().jsonpath("$..document", String.class)
    .to("file:target/messages/others");

I expected two output files with contents similar to this:

"document": {
  "name": "document 1",
  "type": "pdf"
}

Strangely enough i got 4 output files with the following content:

file 1: [{"name":"document 1"
file 2: "type":"pdf"}
file 3: {"name":"document 2"
file 4: "type":"pdf"}]

Am i doing something wrong with my JsonPath? Any help is very much appreciated!

Cheers,

- Joery





RE: camel-http4 cookieStore property

2018-01-29 Thread Joery Vreijsen
Hi Stephan,

That does indeed seem to work, I had to find this notation in the 
http-session-handling documentation 
(http://camel.apache.org/http-session-handling.html) as it wasn’t so clear from 
the http4 documentation page (http://camel.apache.org/http4.html).

Thanks!

- Joery Vreijsen

On 29 Jan 2018 12:14 +0100, Siano, Stephan <stephan.si...@sap.com>, wrote:
> Hi,
>
> just some guess from the error message. Have you tried:  uri="http4://localhost:9001?cookieStore=#customCookieStore" />?
>
> Best regards
> Stephan
>
> -Original Message-
> From: Joery Vreijsen [mailto:jhjvreij...@gmail.com]
> Sent: Montag, 29. Januar 2018 10:53
> To: users@camel.apache.org
> Subject: camel-http4 cookieStore property
>
> Hi,
>
> I’m trying to set a customCookieStore to my http4 endpoint configured as 
> below:
>
> 
> This gives me the following exception:
>
> Failed to resolve endpoint: 
> http4://localhost:9001?cookieStore=customCookieStore due to: Could not find a 
> suitable setter for property: cookieStore as there isn't a setter method with 
> same type: java.lang.String nor type conversion possible: No type converter 
> available to convert from type: java.lang.String to the required type: 
> org.apache.http.client.CookieStore with value customCookieStore
>
> It doesn’t seem get the reference to my declared bean of the 
> customCookieStore:
>
> 
> Am I doing something wrong in the configuration?
>
> When declaring a bean for the http4 component in my blueprint.xml, it does 
> however work as expected:
>
>       
> Cheers!
>
> - Joery Vreijsen
>
>
>


camel-http4 cookieStore property

2018-01-29 Thread Joery Vreijsen
Hi,

I’m trying to set a customCookieStore to my http4 endpoint configured as below:



This gives me the following exception:

Failed to resolve endpoint: 
http4://localhost:9001?cookieStore=customCookieStore due to: Could not find a 
suitable setter for property: cookieStore as there isn't a setter method with 
same type: java.lang.String nor type conversion possible: No type converter 
available to convert from type: java.lang.String to the required type: 
org.apache.http.client.CookieStore with value customCookieStore

It doesn’t seem get the reference to my declared bean of the customCookieStore:



Am I doing something wrong in the configuration?

When declaring a bean for the http4 component in my blueprint.xml, it does 
however work as expected:


    


Cheers!

- Joery Vreijsen





Re: Invoke Camel Backlog Tracer

2017-12-20 Thread Joery Vreijsen
Thanks, i believe it is working now.

Unfortunately i don’t think logging to log files will do it for me.

My goal is to create an api endpoint that can retrieve the traced
messages from the Backlog Queue.
In the api endpoint i have access to the Camel Context (and thus the
backlogTracer), but i’m looking for a way to deploy the blueprint xml
with the backlog tracer enabled.

I tried setting the trace=“true” property to see if it enables the
backlogTracer on startup, but with no luck.

2017-12-20 12:37 GMT+01:00 Claus Ibsen <claus.ib...@gmail.com>:
> Hi
>
> Replying again as there may be an issue with Joery seeing the mails from here
>
> If you just want to have tracing to log files, then using "trace=true"
> in  is not deprecated and you can use that.
>
> On Tue, Dec 19, 2017 at 5:09 PM, Joery Vreijsen <jhjvreij...@gmail.com> wrote:
>> Hi There!
>>
>> First of all this is my first time posting in the the mailing list, so
>> any feedback is appreciated.
>>
>> Im currently experimenting with the Backlog Tracer as we are currently
>> upgrading our application to Camel 2.20.1 and the “old” Tracer is
>> Deprecated.
>> In the documentation (http://camel.apache.org/backlogtracer.html) i
>> was looking for an example to invoke the Backlog Tracer in a Blueprint
>> xml.
>>
>> This is what i tried (as it was working for the Tracer):
>>
>> 
>> http://www.osgi.org/xmlns/blueprint/v1.0.0;
>>xmlns:camel="http://camel.apache.org/schema/blueprint;
>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>>xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
>>http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd;>
>>
>> > class="org.apache.camel.processor.interceptor.BacklogTracer">
>> 
>> 
>>
>> > xmlns="http://camel.apache.org/schema/blueprint”>
>> // Example route
>> 
>> 
>> 
>> 
>> 
>>
>> 
>>
>> Unfortunately this results in the blueprint saying the BacklogTracer
>> is already instantiated.
>> org.osgi.service.blueprint.container.ComponentDefinitionException:
>> Name backlogTracer is already instanciated as null and cannot be
>> removed.
>>
>> Any suggestions how to enable the Backlog Tracer by default in a blueprint 
>> xml?
>>
>> All help is appreciated!
>>
>> Greetings,
>>
>> - Joery
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2


Invoke Camel Backlog Tracer

2017-12-19 Thread Joery Vreijsen
Hi There!

First of all this is my first time posting in the the mailing list, so any 
feedback is appreciated.

Im currently experimenting with the Backlog Tracer as we are currently 
upgrading our application to Camel 2.20.1 and the “old” Tracer is Deprecated.
In the documentation (http://camel.apache.org/backlogtracer.html) i was looking 
for an example to invoke the Backlog Tracer in a Blueprint xml.

This is what i tried (as it was working for the Tracer):


http://www.osgi.org/xmlns/blueprint/v1.0.0;
           xmlns:camel="http://camel.apache.org/schema/blueprint;
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
           http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd;>

    
        
    

    http://camel.apache.org/schema/blueprint”>
        // Example route
        
            
            
        
    



Unfortunately this results in the blueprint saying the BacklogTracer is already 
instantiated.
org.osgi.service.blueprint.container.ComponentDefinitionException: Name 
backlogTracer is already instanciated as null and cannot be removed.

Any suggestions how to enable the Backlog Tracer by default in a blueprint xml?

All help is appreciated!

Greetings,

- Joery


Invoke Camel Backlog Tracer

2017-12-19 Thread Joery Vreijsen
Hi There!

First of all this is my first time posting in the the mailing list, so
any feedback is appreciated.

Im currently experimenting with the Backlog Tracer as we are currently
upgrading our application to Camel 2.20.1 and the “old” Tracer is
Deprecated.
In the documentation (http://camel.apache.org/backlogtracer.html) i
was looking for an example to invoke the Backlog Tracer in a Blueprint
xml.

This is what i tried (as it was working for the Tracer):


http://www.osgi.org/xmlns/blueprint/v1.0.0;
   xmlns:camel="http://camel.apache.org/schema/blueprint;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
   xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
   http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd;>





http://camel.apache.org/schema/blueprint”>
// Example route








Unfortunately this results in the blueprint saying the BacklogTracer
is already instantiated.
org.osgi.service.blueprint.container.ComponentDefinitionException:
Name backlogTracer is already instanciated as null and cannot be
removed.

Any suggestions how to enable the Backlog Tracer by default in a blueprint xml?

All help is appreciated!

Greetings,

- Joery