How to create a temporary jms queue with jboss?
1 answer
From the Queue / TopicSession jms object: see the QueueSession javadoc .
You need to leave the session open for the timing queue lifecycle.
A typical use is for a client to open a session and place a message on the general processing queue using the temporary queue in the message's response field. for example: (pseudo code)
Queue queue = session.createQueue("shared");
Queue responseQueue = session.createTemporaryQueue();
Message message = session.createMessage();
message.setJMSReplyTo(responseQueue);
...
session.commit();
...
MessageConsumer responseConsumer = session.createConsumer(responseQueue);
Message response = responseConsumer.receive();
...
session.close();
The MDB (or the listener that reads the shared process queue) will send the response back to the response queue. If the client is dead for any reason, its session is closed and the queue has ceased to exist.
+3
source to share