Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In addition, this component can use all ServiceMix flows (including clustered and transactional flows), can be configured to be resilient to crashes and supports full fail-over to another node when clustered.

...

For comparing elements of a sequence the resequencer component can be configured with a sequence element comparator. A default comparator is provided that compares message exchanges based on Long sequence numbers. This comparator expects the sequence number to be the value of the org.apache.servicemix.eip.sequence.number property of the exchanges's in-NormalizedMessage. The name of the property can be customized in the comparator configuration (see below). You may also provide a custom comparator by implementing the SequenceElementComparator interface.

Code Block
xml
xml

<beans 
    xmlns:sample="http://www.example.org/resequencer"
    xmlns:eip="http://servicemix.apache.org/eip/1.0">

    <eip:resequencer 
        service="sample:Resequencer"
        endpoint="ResequencerEndpoint"
        comparator="#comparator"
        capacity="100"
        timeout="2000">
        <eip:target>
            <eip:exchange-target service="sample:SampleTarget" />
        </eip:target>
    </eip:resequencer>

    <!-- Configure default comparator with custom sequence number property -->
    <eip:default-comparator id="comparator" sequenceNumberKey="seqnum"/>

</beans>

A running example can be downloaded from here. In this example, a custom-coded message sender sends messages in "wrong" order to the resequencer. The resequencer re-orders these messages and (synchronously) sends them to a file sender-endpoint. The file sender-enpoint writes the messages (in proper order) to the work/output directory.

...