You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by PJ Walstroem <wa...@hotmail.com> on 2012/06/20 13:02:12 UTC

Split: how to leave message untouched?

hello,
I split messages using 

from(incomingQueue)
.startupOrder(1)
*.split().tokenizeXML("update", "dbStream")*
.convertBodyTo(Document.class)
.choice()
.when().xpath(SUBSCRIPTION_XPATH)
.to(AGGREGATE_MESSAGES)
.otherwise()
.to(PRODUCERS)
.end();

however, when the XML does not contain neither <update> nor <dbStream>, the
routing just seems to stop. Is there a way to let messages through that are
not applied by the split?

According to  http://camel.apache.org/splitter.html
http://camel.apache.org/splitter.html , "The Splitter will by default return
the original input message", but I can not see that happen in this case.

Using Camel 2.9.2

--
View this message in context: http://camel.465427.n5.nabble.com/Split-how-to-leave-message-untouched-tp5714734.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Split: how to leave message untouched?

Posted by PJ Walstroem <wa...@hotmail.com>.
thank you, that worked perfectly.

--
View this message in context: http://camel.465427.n5.nabble.com/Split-how-to-leave-message-untouched-tp5714734p5714749.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Split: how to leave message untouched?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Easier to crete a route for the splitter
And then have another route that does the filter. And use the direct
endpoint to call the other route.

from X
  filter bla
    to splitme
  end
    common stuff here

from direct:splitme
   split tokenize xml


On Wed, Jun 20, 2012 at 2:55 PM, PJ Walstroem <wa...@hotmail.com> wrote:
> if the filter() Predicate returns false, I assume the processing stops there?
> I would like to go beyond the split() and carry on with the .convertBodyTo()
> etc. in case the filter() returns false.
>
> I tried something like
> from(incomingQueue)
> .choice()
> .when().xpath(UPDATE_XPATH)
> .split().tokenizeXML("update", "dbStream")
> .end()
> .convertBodyTo()
> ....
>
> and even
> from(incomingQueue)
> .split(xpath(UPDATE_XPATH).tokenizeXML("update", "dbStream"))
> .end()
> .convertBodyTo()
>
> but they are not correct. Don't know how to solve this
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Split-how-to-leave-message-untouched-tp5714734p5714743.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Split: how to leave message untouched?

Posted by PJ Walstroem <wa...@hotmail.com>.
if the filter() Predicate returns false, I assume the processing stops there?
I would like to go beyond the split() and carry on with the .convertBodyTo()
etc. in case the filter() returns false.

I tried something like
from(incomingQueue)
.choice()
.when().xpath(UPDATE_XPATH)
.split().tokenizeXML("update", "dbStream")
.end()
.convertBodyTo()
....

and even
from(incomingQueue)
.split(xpath(UPDATE_XPATH).tokenizeXML("update", "dbStream"))
.end()
.convertBodyTo()

but they are not correct. Don't know how to solve this



--
View this message in context: http://camel.465427.n5.nabble.com/Split-how-to-leave-message-untouched-tp5714734p5714743.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Split: how to leave message untouched?

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Jun 20, 2012 at 1:02 PM, PJ Walstroem <wa...@hotmail.com> wrote:
> hello,
> I split messages using
>
> from(incomingQueue)
> .startupOrder(1)
> *.split().tokenizeXML("update", "dbStream")*
> .convertBodyTo(Document.class)
> .choice()
> .when().xpath(SUBSCRIPTION_XPATH)
> .to(AGGREGATE_MESSAGES)
> .otherwise()
> .to(PRODUCERS)
> .end();
>
> however, when the XML does not contain neither <update> nor <dbStream>, the
> routing just seems to stop. Is there a way to let messages through that are
> not applied by the split?
>

You can use the filter EIP to filter out message that are not <update>
XML messages.
The tokenizeXML requires the message structure to be XML and have a
root tag named <update> which contains a list of child tags named
<dbStream>.

> According to  http://camel.apache.org/splitter.html
> http://camel.apache.org/splitter.html , "The Splitter will by default return
> the original input message", but I can not see that happen in this case.
>
> Using Camel 2.9.2
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Split-how-to-leave-message-untouched-tp5714734.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen