0

While using a soap/jms web service , i am using an EJB deployed on a WAS as my client. My service endpoint is a tibco ems queue. To call the service, i construct a SOAP messgae and drop it on the queue.

But my confusion is: How can the 'queue' send me back a response? I understand how http request response works, but with queue (I only have experience with traditional MQ), I don't know how queue can return a proper resposne to the publisher.

Let us say there is an MDB that consume the message from the queue, invokes the service method and then puts the response back on the queue? And then the queue sends the response back to the client?

ᄂ ᄀ
  • 5,669
  • 6
  • 43
  • 57
Victor
  • 16,609
  • 71
  • 229
  • 409

1 Answers1

1

The response will be sent back on a different queue or topic, which is specified in a property of the request message.

The response queue/topic can be set in the request message using the method msg.setJMSReplyTo(destination) (http://docs.oracle.com/cd/E17802_01/products/products/jms/javadoc-102a/javax/jms/Message.html#setJMSReplyTo%28javax.jms.Destination%29).

When using the QueueRequestor to send the request, as usual and recommended, then a temporary queue is created for each individual request-reply interaction.

Miichi
  • 1,739
  • 1
  • 14
  • 16
  • Thanks. So the resposne queue will send the response back to the publisher? So after putting the message on the request queue the publisher immediately returns and opens up a connection to the resposne queue? – Victor Oct 09 '13 at 20:51
  • Well, the publisher would open the connection to the response queue actually before sending out the request message. (Not so important in the queue case, more in the topic case, where you might have a race condition that loses messages otherwise.) However, the JMS-API hides that from you when you use `QueueRequestor.request(...)`, which just gives you the response message as the return value. – Miichi Oct 09 '13 at 21:08