0
votes

How do I get an specific "JMSMessageID" from the ActiveMQ Queue? I mean, imagine that a client sends a request to the queue, gets processed and its waiting for his response (from a Response Queue, lets say).

In other words, the client is listening to the response queue. Now he wants HIS response to be returned.

As far as i've read there could be a possibility of getting it using a correlationId or messageId.

So i imagine there could be a way to set and ID to the request and the response to then be filtered by it. Right?

Haven't found much help from the Mule Documentation so far. Only the basics.

How can this be achieved?

Thanks.

1
Instead of filtering messages off of a single response queue why not just use the request/reply pattern already in JMS and supported by Mule? Let the JMS broker handle matching requests and replies instead of you having to set correlation ids.gregwhitaker
So you are telling me the ActiveMQ matches request-response to the respective client automatically? o.O Eventhough there are lets say, 1000 requests and 1000 responses? it will deliver them individually and "synchronously" to its client? And then, i don't need to create a Response Queue then, since it will be replied back, correct?msqar
Automatic may be a bit of a misnomer. The JMS spec supports request/reply with the JMSReplyTo parameter. You would set this on the server side of your application and the broker will make sure that it gets back to the correct requester. It is creating a temporary queue under the covers for that single request instead of one giant one that has to be picked through.gregwhitaker
Oh i see.. its currently working like that, the ReplyTo is set automatically to the PC ID (Client) i requested it from, no response queues whatsoever. Mmmmm interesting.msqar
Reply-to is only used with a request-response interaction over a JMS endpoint, using a temp queue, if you use the request-reply routing message processor then the response will be consumed from the response queue and correlated with the request on the correlation ID.David Dossot

1 Answers

2
votes

It seems you are referring to the request-reply routing message processor of Mule that allows you to block a flow execution until a response is received on an asynchronous channel, Mule taking care of matching the requests and responses via correlation ID.

This would work fine with a JMS request queue and a JMS response queue.

You would get the same behaviour as with using a request-response JMS endpoint but without the use of temporary response queues.