Guide to Resequencer (Message Routing)
A Message Router is designed to route messages from one channel to another channel determined by its examination of the message content or other business criteria. However, it is possible that individual messages could travel different routes before reaching their endpoint. Also, another consideration is that some messages could pass through the processing steps sooner than others, this has the potential result of messages getting out of order. Therefore, if the order of the messages is important, think of a loan approval process, then these messages must be converted back into their proper order using the Resequencer integration pattern.
The Resequencer has the capability to receive a stream of out-of-order messages and then through the use of an internal buffer it will persist these messages until a complete sequence is obtained. The newly created in-sequence messages are then transmitted to our designated output channel.
Â
Resequencer using XML DSL (Batch)
In this example, we will be re-ordering the message based on the content of the message body. The default batch modes will collect up to 100 messages per batch:
Â
<route>
<from uri="direct:input"/>
<resequence>
<simple>${body}</simple>
<to uri="output:result"/>
</resequence>
</route>