Home > Blockchain >  How to maintain order of messages among multiple instances of same application
How to maintain order of messages among multiple instances of same application

Time:07-15

We have a very simple application which read messages from MQ and transform the messages into some different format and send it to another MQ. Application deployed in Openshift environment. Hence at any given time multiple instances of the same application will be running. And we are not using any DB in our application. We want to maintain the order of messages. Basically while reading the messages, they were present in source MQ with some order(for e.g. A1-A2-A3-A4-A5) then post transformation they should be in same order in out MQ. Eg.: Let's suppose event A1 has happened then A2 and then A3 and then A4 and then A5. Events A1 and A3 are interlinked means has some relation. Multiple instances of same application listening on dedicated Queue for these events. Lets suppose there were 5 instances of applications running, then there can be a case where instance which has picked A3 event has finished processing. While A1 event processing still not completed. So basically I want to ensure A3 processed output should not be sent to out Queue until its previous event A1 is completed successfully and sent to out queue. Can someone please help me with this problem?

CodePudding user response:

IBM MQ has built-in features for grouping messages together. I would suggest you have a look at Message Groups.

CodePudding user response:

In my opinion message grouping has one disadvantage : The putting application has to finish groups with MQMF_LAST_MSG_IN_GROUP.

The getter normally works with MQGMO_ALL_MSGS_AVAILABLE.

Does the putter have any chance to know when a group is finished? If not you cannot use grouping.

  • Related