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.

Reply via email to