Hi

A good idea is to check the docs
http://camel.apache.org/predicate.html

For example you can use the front page of Apache Camel
http://camel.apache.org/

And type in keywords in the search box.

As well read some of the intro guides and whatnot.
There is also a lot of links to external Camel intro and resources at
http://camel.apache.org/articles



On Mon, Aug 19, 2013 at 4:00 AM, peacock.snowdrift
<[email protected]> wrote:
> Hello,
>
> Complete Camel newbie here, so apologies if this is a silly question.
>
> I have a piece of code along the lines of:
>
> if (localVar == value) {
>     from(uri)
>     ... stuff here...
>     .to(destination);
>     .to(additionalDestination);
> } else {
>     from(uri)
>     ... stuff here...
>     .to(destination)
> }
>
> I've tried using a Predicate on the localVar value to tidy up this
> definition - as I'm duplicating code with 2 virtually identical routes apart
> from small differences otherwise - but can't seem to access it:
>
> Predicate predicate = {what goes here?};
>
> from(uri)
> ... stuff here...
> .to(destination)
> .choice()
> .when(predicate).to(additionalDestination);
>
> Can I do so, or is there a better way of making this statement more
> graceful?
>
> Thanks for any assistance.
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Conditional-routing-and-local-variables-tp5737490.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [email protected]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to