I am trying to implement simple content based router using Spring integration and cannot figure out what should be the right way.
On input channel I receive a simple XML message
Based on the age value i want to determine whether a passenger is infant, child or adult, and direct message to a corresponding channel, i.e. infantChannel, childChannel or adultChannel. I want to use XPath to define conditions of the content based filter, since it is XML message.
Apache Camel Solution
With Apache Camel it is rather straight forward
Spring Integration Solution
<xpath>/passenger/age <= '1'</xpath>
<xpath>/passenger/age > '1' and /passenger/age <= '12'</xpath>
<xpath>/passenger/age > '12'</xpath>
Well... I wasn't able to figure out and run out of patience. That is why I am writing to this forum.
It was logical to use <xpath-router>, but based on the documentation the output channels are determined dynamically based on the result of the XPath expression.
What I am trying to do is the following
Based on the doc, the XPath expressions are evaluated as NODESET and converter to list of strings, where every value of this list represents a channel name to which this message will be sent. In my case this will be just a list of integers from <age> message element and this this is not what I want. I just have four channels I want the message to be sent to.
<si-xml:xpath-router id="passengerRouter" input-channel="passengerChannel" resolution-required="true" >
So, my question is how to configure <xpath-router> to implement my case?
Thanks in advance.