We have a use case of putting a group of messages with a same groupId but differing by MessageSequenceNumber. This is used to group the messages for a logical ordering so that on the receiver side, receiver can group all of the messages based on group order. I was following the IBM MQ v7.5 Knowledge Center page "Message groups".
I have a code written to put the messages : -
public boolean writeMessage(String[] messages, String queueName) {
Session session = getQueueConnection().createSession(true,
Session.AUTO_ACKNOWLEDGE);
Destination destination = session.createQueue(queueName);
messageProducer = session.createProducer(destination);
for (int i = 0; i < messages.length; i++) {
TextMessage message = session.createTextMessage(messages[i]);
messageProducer.send(message);
}
// Commit the send (Actually put messages to Queue)
session.commit();
return true;
}
Now , I want to add a 1 unique groupID to all the messages which are inside an array and add a sequence number(msgSeqNum) (1,2,3..) . How can i do it through the JMS API? I am looking for JMS version of the code on the IBM IIB v8 Knowledge center page "Sending messages in a WebSphere MQ message group.