How can I implement the 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>
Simple element required (see accepted answer )
<simple>${header.type} == 'widget'</simple>
Note that the field expression is surrounded by $ {}, followed by OGNL syntax for comparison, which is not part of the field expression itself.