camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: When/Otherwise & multiple 'statements'
Date Fri, 21 Jan 2011 12:15:27 GMT
On Fri, Jan 21, 2011 at 1:11 PM, Samuel Cox <crankydillo@gmail.com> wrote:
> Hi,
>
> I have the following Scala DSL route defined:
>
> when (...) {
>   process(...)
>   --> (...)
>   --> (...)
> } otherwise {
>   process(...)
>   --> (...)
> }
>
> For various reasons, I need to implement this with a Java DSL route,
> but I can't figure out how to nest multiple statements.  All the
> examples I see are of this form:
>
> when(...)
> .to(...)
> .otherwise()
> .to(...)
>
> Any ideas or pointers towards doc that would help me implement this
> with a Java DSL would be greatly appreciated.
>

You can just do

choice().
 when(...)
 .to(...)
 .to(...)
 when(...)
 .to(...)
 .to(...)
 .otherwise()
 .to(...)
 .to(...)
 .to(...)
 .end() // end otherwise and also the CBR
// here you can do stuff after the CBR if you like

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

Mime
View raw message