Thomas G
Thomas G

Reputation: 23

Java Message selector for getting group Message from websphere mq

I'm trying to Receive a Group Message from a websphere mq 8 Queue Manager within a Java mdb. When getting the LastMessageInGroup I Receive a jmsxgroupid like 'ID:45fdea5589' (getStringProperty) from the message. When I'm trying to get the other Messages of this Group I'm Using a messageconsumer with a messageselector where I'm Adding exactly the jmsxgroupid with an additional jmsxsequence from above, but When calling the method receiveNoWait from the messageConsumer I receive a Null BytesMessage

The Funny thing is, when the groupid is Human readable String like '20151019' it Works.

So this is part of the Code.
We receive lastMessage in the method onMessage of our MDB.
We read the JMSXGroupID of this lastMessage with the method
String gid = lastMessage.getStringProperty("JMSXGroupID"). Then we build a selector to get the other message(s) of this group like this:
String strSelector = "JMSXGroupID='" + gid + "' AND JMSXGroupSeq=1";
consumer = session.createConsumer(destIncoming, strSelector);
bmCurrentMessage = (BytesMessage) consumer.receiveNoWait();
When the gid is like 'ID:8d74b544d5862f32156cbfe845077c02d18ba33ac51c06aa' we receive a null BytesMessage! The mq acts like the queue is empty.
When the gid is like '20151015081515' we receive the other messages of the group message!

Any Tips what I Should do different?

Thanks so far for Reading Thomas

Upvotes: 1

Views: 1453

Answers (2)

Thomas G
Thomas G

Reputation: 23

Well after long time of analysing together with MQ experts from IBM we had to install a fix package offered by IBM to fix this problem. So there was obviously no problem with our code but some problem inside the IBM code of the MQ Server 8 we were using.

Now the problem is solved by installing the latest fix of IBM.

Thanks to all for reading and thinking about my problem!

Upvotes: 1

Morag Hughson
Morag Hughson

Reputation: 7525

Remember that the GroupID, just like the MessageID and CorrelationID, is not a string field. You say it works when it is a human readable string, which implies the times it is failing for you is when the GroupID is not human readable. This suggests you are not requesting the correct GroupID for the subsequent messages in the group because of the string processing you have done on it. Treat it as a byte string and not a character string.

Upvotes: 1

Related Questions