You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by nikagra <ni...@gmail.com> on 2013/05/06 14:28:14 UTC

Question about Camel end() and endChoice() expressions

Hello

I have question about end() and endChoice() expressions. Here is how my
route looks like:
Some XML-->split-->continue processing

XML structure is like:
<person><name>V. Lenin</name><address>Soviet Russia, Moscow,
Kremlin</address></person>

Here is part of my route:
.split(xpath("/person/*"))
	.convertBodyTo(String.class)
	.choice()
		.when(xpath("/address"))
			.setBody(xpath("/person/adderss/text()"))
			.to("direct:processAddress")
		.when(xpath("/name"))
			.setBody(xpath("/person/name/text()"))
			.to("direct:process")
	.end() // (*)
.end()

During XML processing I want to process parts of XML (i.e. write them to
file) and then process initial XML as a whole. I've found that depending of
what I put to line marked with asterisk message will contain either one of
splitted parts (name or address if endChoice() is put in this line) or whole
message (in case of end()).
I failed to find some exhaustive documentation on when I should use end() or
endChoice() expressions

Could you please explain such behavior?



--
View this message in context: http://camel.465427.n5.nabble.com/Question-about-Camel-end-and-endChoice-expressions-tp5732079.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Question about Camel end() and endChoice() expressions

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

A good idea is to use the search box on the Camel front page
Then you can type in eg: endChoice and read the links



On Mon, May 6, 2013 at 2:28 PM, nikagra <ni...@gmail.com> wrote:
> Hello
>
> I have question about end() and endChoice() expressions. Here is how my
> route looks like:
> Some XML-->split-->continue processing
>
> XML structure is like:
> <person><name>V. Lenin</name><address>Soviet Russia, Moscow,
> Kremlin</address></person>
>
> Here is part of my route:
> .split(xpath("/person/*"))
>         .convertBodyTo(String.class)
>         .choice()
>                 .when(xpath("/address"))
>                         .setBody(xpath("/person/adderss/text()"))
>                         .to("direct:processAddress")
>                 .when(xpath("/name"))
>                         .setBody(xpath("/person/name/text()"))
>                         .to("direct:process")
>         .end() // (*)
> .end()
>
> During XML processing I want to process parts of XML (i.e. write them to
> file) and then process initial XML as a whole. I've found that depending of
> what I put to line marked with asterisk message will contain either one of
> splitted parts (name or address if endChoice() is put in this line) or whole
> message (in case of end()).
> I failed to find some exhaustive documentation on when I should use end() or
> endChoice() expressions
>
> Could you please explain such behavior?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Question-about-Camel-end-and-endChoice-expressions-tp5732079.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen