Guide to XML DSL (Content-based Router)

In some scenarios, a single logical process and its implementation (ie. price check), could be spread across many different physical systems. We need to ensure that the message is being sent to the correct consumer using information contained with the message itself.

In the following example, we see the implementation of a Content-based Router pattern to route the message to the correct consumer using the Choice option.

 

XML DSL Example

 

<route> <from uri="jms:queue:order"/> <choice> <when> <simple>${header.type} in 'widget,wiggy'</simple> <to uri="jms:queue:order:widget"/> </when> <when> <simple>${header.type} == 'gadget'</simple> <to uri="jms:queue:order:gadget"/> </when> <otherwise> <to uri="jms:queue:order:misc"/> </otherwise> </choice> </route>