Resequencer
The Resequencer from the EIP patterns allows you to reorganise messages based on some comparator. By default in Camel we use an Expression to create the comparator; so that you can compare by a message header or the body or a piece of a message etc.
The following example shows how to reorder the messages so that they are sorted in order of the body() expression.
Using the Fluent Builders
Wiki Markup |
---|
{snippet:id=example|lang=java|url=activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ResequencerTest.java} |
You can of course use many different Expression languages such as XPath, XQuery, SQL or various Scripting Languages.
You could replace this expression with
Code Block |
---|
reschedule(header("JMSPriority"))
|
for example to reorder messages using their JMS priority.
Using the Spring XML Extensions
For further examples of this pattern in use you could look at the junit test case
Include Page | ||||
---|---|---|---|---|
|
...