THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||
---|---|---|---|---|
| ||||
from("jms:queue:order") .choice() .when(isWidget).to("bean:widgetOrder") .when(isWombat).to("bean:wombatOrder") .otherwise() .to("bean:miscOrder") .end(); |
Negating a Predicate
You can use the not method on the PredicateBuilder
to negate a predicate.
First we import the not static, so it makes our route nice and easy to read:
Code Block |
---|
import static org.apache.camel.builder.PredicateBuilder.not
|
And then we can use it to enclose an existing predicate and negate it as the example shows:
Wiki Markup |
---|
{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceNotPredicateTest.java} |
Compound Predicates
You can also create compound predicates using boolean operators such as and, or, not
and many others.
The sample below demonstrates this:
...