Apache Camel — Content Based Routing

CBR — routes messages based on the content of the message body.

Image source — http://camel.apache.org/content-based-router.html
<camelContext errorHandlerRef=”errorHandler” xmlns=”http://camel.apache.org/schema/spring">
<route>
<from uri=”direct:a”/>
<choice>
<when>
<xpath>$foo = ‘bar’</xpath>
<to uri=”direct:b”/>
</when>
<when>
<xpath>$foo = ‘cheese’</xpath>
<to uri=”direct:c”/>
</when>
<otherwise>
<to uri=”direct:d”/>
</otherwise>
</choice>
</route>
</camelContext>