Consider two processes A and B. A wants to send a message to B's queue and A wants B to reply to A's message. For example, A sends to queue 'Consumer' that B creates, and B sends the reply to A's 'Producer' queue. How would the clients implement this scenario?

Andreas Mueller

First,client 'B' cannot create a queue 'Consumer'. This is an administration task, performed by administration tools. If the queue exists, 'B' can look up the queue and can create a QueueReceiver to receive incoming messages. If the JMSReplyTo header of a message contains a destination object (a TemporaryQueue), 'B' can send a message to it (via a QueueSender created for this destination). To implement this request/reply pattern, client 'A' can use a QueueRequestor helper class, which is part of JMS.