saptarshi
saptarshi

Reputation: 97

Get responses based on corretionID from IBM MQ for multi-thread scenario

My requirement is that:

I have an IBM MQ which is shared across 20 servers and runs the JMS client. Now there will be a specific message in the queue which is intended for a particular thread. The thread need to use a correlationID to fetch the message from all the messages in the MQ.

When I am using onMessage() it is uncertain which thread will Listen to the message. Suppose server-1 is waiting for the message but server-15 listens it. Server-1 gets eventually timed out even though there was a message intended for the thread in server-1.

Please suggest how we are going to handle this scenario without introducing major performance issue.

Upvotes: 1

Views: 59

Answers (1)

Gary Russell
Gary Russell

Reputation: 174664

Use a MessageSelector on the listener container(s). If the correlationId is in the standard JMSCorrelationID header the selector would be JMSCorrelationID=foo to receive all foo messages.

Upvotes: 3

Related Questions