Posted: Fri Sep 06, 2002 5:13 am Post subject: Messagefilter
Newbie
Joined: 30 Jul 2002 Posts: 5
Hello together
Is it possible to receive messages from a queue only for a given
correlationID ? I got the following problem. I want to write a
method like this public String getMessage(String correlationID).
But as I now you always got the first message on the queue if
you call receive(). And if the first message isn't the one with the
corresponding correlationID I've to persist it somewhere. So my
question is:
Is there a possibility with MQ and Java to look on a queue and
receive only those messages I need ?
In the MQQueue::get call, you pass in a message object.
Just set the correlationId field in the message object before the get call and the get will return the message you want. correlationId is a byte array of 24 bytes.
U can specify message selector, can be corl-ID, for message listener, which in turn will pick the message which matches the criteria. And can specify the receive time.
If u couldnt solve the problem let me know ... may be i'll send u the snippet of code
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum