Category: JMS questions
Can I implement synchronous request/response patterns with JMS?
Yes you can. The key lies in connecting the response message to the request message, so that the client can figure out which messages belong together. The most convenient way to do this is via the JMSMessageID and the JMSCorrelationID. Every message is assigned its own unique message ID when it is sent or published. This ID can be queried by the receiver and put into the response message's JMSCorrelationID attribute. When the request sender receives the response, it can query the JMSCorrelationID attribute to make the connection to the original request.
Take a look at the JavaDocs for some of the involved APIs.