Interview Questions

How do I handle request/response using JMS?

BEA WebLogic Questions and Answers


(Continued from previous question...)

How do I handle request/response using JMS?

There are several approaches to handling request/response processing with JMS.
* Use a temporary queue for each requestor and have the response go back to that queue.
* Use the QueueRequestor class, which does the temporary queue for you, and wait for the reply, as in the following:
// create temporary queue for receiving answer
qrequestor = new QueueRequestor(qsession, queue);
TextMessage msg = qsession.createTextMessage();
TextMessage reply = (TextMessage) qrequestor.request(msg);
* Use a dedicated response topic or queue with message selectors.

(Continued on next question...)

Other Interview Questions