Sorry, earlier posting was truncated, some how.
-------------------------
We have a used a topic to post requests, that are sent to external application, by the Topic Subscriber. When we receive response back, we want to match the request to the response.
The way we thought we could achieve this is, by appending a uniqueID to the request and receiving the same ID back in the response (the external application guarantees to send that ID back). At the time of receiving the response create a durable subscriber to the same Topic above, and based on the ID of the response, receive the corresponding request from the Topic, using the message selector.
However, with what we have seen, message selector can only be supplied as constructor argument. And, message selector has to have some value. In our case, it ought to be some thing like ID = '12345'. But, we don't know '12345' until we have received a response back from external application on the fly.
With out having the second subscriber; we probably will loose the requests form the Topic by the time we receive responses back from external application, as they are received by the first subscriber.
Any suggestions/ ideas?
-
JMS Question - Revised (2 messages)
- Posted by: Srini Allu
- Posted on: December 02 2005 17:07 EST
Threaded Messages (2)
- JMS Question - Revised by Einar Valen on December 05 2005 03:59 EST
- JMS Question - Revised by James Strachan on December 05 2005 11:35 EST
-
JMS Question - Revised[ Go to top ]
- Posted by: Einar Valen
- Posted on: December 05 2005 03:59 EST
- in response to Srini Allu
One common way of matching up a response with a sent message, is to have the message consumer return the MessageID in CorrelationId.
Then the message producer can create a receiver with a massage selector to qualify the response.
Something like this:
String messageSelector = "JMSCorrelationID='" + messageSent.getJMSMessageID() + "'";
QueueReceiver queueReceiver = queueSession.createReceiver( queue, messageSelector ); -
JMS Question - Revised[ Go to top ]
- Posted by: James Strachan
- Posted on: December 05 2005 11:35 EST
- in response to Srini Allu
Here's an overview of how to implement request-response in JMS along with a link to some source code you can reuse...
http://activemq.org/How+should+I+implement+request+response+with+JMS
James
LogicBlaze