O'Reilly logo

Just Spring Integration by Madhusudhan Konda

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Resequencers

An important characteristic of a messaging system is the order of the messages. Although in some cases, the ordering defeats the performance, it is sometimes mandated by some applications. For example, when a message publisher comes back after a crash, the replay of the messages should appear in an orderly fashion.

The Resequencer component has the ability to order the incoming messages. For example, if 10 messages are published to a channel but in the wrong order, the consumer plugged in after the Resequencer does its work will receive all of them in a predefined sequence, e.g., message 1, message 2, etc.

The Resequencers work on the SEQUENCE_NUMBER header field to track the sequences. Say a message numbered 8 (out of 10 child messages) is the first to arrive; the Resequencer does not publish this message, since message number 1 (the first SEQUENCE_NUMBER) or messages numbered 2 through 7 have not arrived. Message 8 (along with any other out-of-order messages) is hence stored either in-memory or in the database until the entire set has arrived and is reordered. The exception is if you set a release-partial-sequences flag to true, which would publish the sequences as soon as they are gathered, rather than waiting for the whole group.

The resequencer element in the integration namespace is used to define a Resequencer as shown in the following snippet:

<int:resequencer input-channel="all-in-reseq-channel" output-channel="reseq-channel" release-partial-sequences="true"> </int:resequencer> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required