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();
5
A
cevap
4
:
<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>
6
gerekli basit eleman (accepted answer bakınız)
olduğunu<simple>${header.type} == 'widget'</simple>
Alan ifadesinin, $ {} takiben O tarafından nasıl çevrildiğine dikkat edin. Alan ifadesinin kendisinin bir parçası olmayan karşılaştırma için GNL sözdizimi.
+1
Yay uygulaması bağlamında başlıkta ad özniteliği yok ve hiç mevcut değil. –
Deve ve yay sürümleriniz nedir? –
Her halükarda bunu yerine olarak deneyebilirsiniz: $ {header.type == 'wombat'} –