Skip to content

Instantly share code, notes, and snippets.

@gulench
Created December 28, 2013 22:22
Show Gist options
  • Save gulench/8164999 to your computer and use it in GitHub Desktop.
Save gulench/8164999 to your computer and use it in GitHub Desktop.
Process messages in parallel with the option of processing messages in a "certain group" in sequence. The solution needs to work in a cluster.

Problem Statement

You want to process a stream of messages in parallel, which would mean processing messages out of sequence. That would be fine in general, but you would want to process messages in a group sequentially in order. For example, you might process orders in parallel and sequencing might not matter between differen orders. But would like to process amendments to the same order in sequence.

Solution

Spring Integration Resequencer

Locking mechanism in the Resequencer is local to the JVM and will not work in the cluster; possible alternatives could be (as mentioned in Resequencer MessageGroup Lock

  • Use a database level lock

References

  1. Parallel Processing and Ordering
  2. Message Groups
  3. Resequencer in Camel
  4. Maintaining the sequence of messages processed by an IBM Integration Bus message flow
  5. WebSphere Message Broker Support » Message Sequencing
  6. Resequencer MessageGroup Lock
  7. Grouping messages using the WebSphere MQ Java and JMS APIs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment