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>
Spring application context doesn't have name attribute in header and <isNotEqualTo> doesn't exist at all.
What's your camel and spring versions?
Anyway you could try this in <when> instead of predicate: <simple>${header.type == 'wombat'}</simple>
The syntax on this one is wrong. Look at Dhiraj's answer.