How can I implement following Predicate Example given in Spring DSL:
Predicate isWidget = header("type").isEqualTo("widget");
from("jms:queue:order")
.choice()
.when(isWidget).to("bean:widgetOrder")
.when(isWombat).to("bean:wombatOrder")
.otherwise()
.to("bean:miscOrder")
.end();
Like this:
<route>
<from uri="jms:queue:order"/>
<choice>
<when>
<simple>${header.type} == 'widget'</simple>
<to uri="bean:widgetOrder"/>
</when>
<when>
<simple>${header.type} == 'wombat'</simple>
<to uri="bean:wombatOrder"/>
</when>
<otherwise>
<to uri="bean:miscOrder"/>
</otherwise>
</choice>
</route>
The required simple element (see accepted answer) is
<simple>${header.type} == 'widget'</simple>
Notice how the field expression is surrounded by ${} followed by OGNL syntax for comparison, which is not part of the field expression itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With