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.
Camel supports two resequencing algorithms:
Batch resequencing collects messages into a batch, sorts the messages and sends them to their output.
Stream resequencing re-orders (continuous) message streams based on the detection of gaps between messages.
By default the Resequencer does not support duplicate messages and
will only keep the last message, in case a message arrives with the same message expression.
However in the batch mode you can enable it to allow duplicates. For Batch mode, in Java DSL
there is a
allowDuplicates() method and in Spring XML there is an
allowDuplicates=true attribute on the
can use to enable it.