Author: chirino Date: Fri Aug 18 03:10:34 2006 New Revision: 432542 URL: http://svn.apache.org/viewvc?rev=432542&view=rev Log: Latest export from confluence Modified: incubator/activemq/site/how-should-i-implement-request-response-with-jms.html incubator/activemq/site/jms.html Modified: incubator/activemq/site/how-should-i-implement-request-response-with-jms.html URL: http://svn.apache.org/viewvc/incubator/activemq/site/how-should-i-implement-request-response-with-jms.html?rev=432542&r1=432541&r2=432542&view=diff ============================================================================== --- incubator/activemq/site/how-should-i-implement-request-response-with-jms.html (original) +++ incubator/activemq/site/how-should-i-implement-request-response-with-jms.html Fri Aug 18 03:10:34 2006 @@ -185,7 +185,7 @@
  • Ajax
  • Axis Support
  • C Integration
  • -
  • C++ Integration
  • +
  • C++ Integration
  • C# and .Net Integration
  • CMS
  • Geronimo
  • @@ -276,8 +276,7 @@ -
    -

    You might think at first that to implement request-response type operations in JMS that you should create a new consumer with a selector per request; or maybe create a new temporary queue per request.

    +

    You might think at first that to implement request-response type operations in JMS that you should create a new consumer with a selector per request; or maybe create a new temporary queue per request.

    Creating temporary destinations, consumers, producers and connections are all synchronous request-response operations with the broker and so should be avoided for processing each request as it results in lots of chat with the JMS broker.

    @@ -289,7 +288,36 @@

    The actual class which does this is the MultiplexingRequestor . It may be just using Spring remoting with Lingo is the simplest way of implementing request response - or maybe you could just use Lingo's Requestor interface to keep the JMS semantics.

    -

    More details here

    +

    More details here

    + +

    Client side

    + +

    So the client side creates a consumer on a temporary queue as follows...

    + +
    +
    // client side
    +Destination tempDest = session.createTemporaryQueue();
    +MessageConsumer responseConsumer = session.createConsumer(tempDest);
    +...
    +
    +// send a request..
    +message.setJMSReplyTo(tempDest)
    +message.setJMSCorrelationID(myCorrelationID);
    +
    +producer.send(message);
    +
    + +

    Server side

    + +
    +
    public void onMessage(Message request) {
    +
    +  Message response = session.createMessage();
    +  response.setJMSCorrelationID(request.getJMSCorrelationID())
    +
    +  producer.send(request.getJMSReplyTo(), response)
    +}
    +
    @@ -299,8 +327,8 @@ Modified: incubator/activemq/site/jms.html URL: http://svn.apache.org/viewvc/incubator/activemq/site/jms.html?rev=432542&r1=432541&r2=432542&view=diff ============================================================================== --- incubator/activemq/site/jms.html (original) +++ incubator/activemq/site/jms.html Fri Aug 18 03:10:34 2006 @@ -185,7 +185,7 @@
  • Ajax
  • Axis Support
  • C Integration
  • -
  • C++ Integration
  • +
  • C++ Integration
  • C# and .Net Integration
  • CMS
  • Geronimo