I need to create temporary queues on fly. How is that possible?
+1
A:
From your jms Queue/TopicSession object: see QueueSession javadoc.
You need to keep the session open for the lifecycle of the temporary queue.
Typical usage is for a client to open a session and put a message on a shared processing queue,using the temporary queue in the reply-to field of the message. eg:(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 listener that read the shared process queue ) will send the response back to the reply-to queue. If the client is dead for any reason, its session is closed and the queue ceased to exist.
vdr
2009-10-16 13:08:06
Thanx, this was correct answer to my question, but I needed different solution. check http://stackoverflow.com/questions/1587231/how-to-create-a-temporary-jms-queue-and-connect-to-it-by-name
newbie
2009-10-19 07:22:06