dcsimg
How do I select messages based on message ids with JMS and IBM MQ series?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Thomas_Olausson
Posted On:   Thursday, August 8, 2002 02:18 PM

I want to accomplish this: A dual directional point-2-point setup: 1. client_1 writes message to a InQueue and saves the messageid. 2. client_2 reads new messages from Inqueue, processes them and writes them to a OutQueue, with the _same_ messageId as it previously got. 3. client_1 waits for a message on the OutQueue with the same messageId it saved. In step 3 I want to make sure that client_1 reads the right response back. I can do this by creating a message selector: QueueReceiver queueReceiver = session.createReceiver(ioQueue, "JMSMessageId = 'long hex string'"); However, it seems like the message ID itse   More>>

I want to accomplish this:
A dual directional point-2-point setup:

1. client_1 writes message to a InQueue
and saves the messageid.

2. client_2 reads new messages from Inqueue,
processes them and writes them to a OutQueue,
with the _same_ messageId as it previously got.

3. client_1 waits for a message on the OutQueue
with the same messageId it saved.

In step 3 I want to make sure that client_1 reads
the right response back. I can do this by creating
a message selector:

QueueReceiver queueReceiver =
session.createReceiver(ioQueue,
"JMSMessageId = 'long hex string'");

However, it seems like the message ID itself isn't in
the JMS message, but in the IBMs MQ header, so I can't
use it in the message selector.

I know this by browsing the queue after step 1;
the JMS message only contains my data and any user-defined
headers but the message Id is somehow wrapped into the IBM MQ.

How can I select from the messages based on the message id?

I have only one option: to have client_1 get a unique number every
time and put that in the JMS-header and make sure that
client_2 puts it back there. This adds some complexity though.

Any tips? I know I can do a QueueRequestor, then I know
the right client gets the right response, but would like
to take the above approach, because I want client_2 to be able to
not acknowledge the message if it encounters errors.

/Thomas

   <<Less

Re: How do I select messages based on message ids with JMS and IBM MQ series?

Posted By:   Thomas_Olausson  
Posted On:   Thursday, August 8, 2002 02:52 PM

And here's the answer:

use this messageselector:
JMSMessageID = 'ID:long hex string'

If you omit 'ID:' it won't work. Silly, but apparently that gets prepended to the string.

Thanks Thomas.

/Thomas
About | Sitemap | Contact