Navnath Kumbhar [
http://community.jboss.org/people/navnath] created the discussion
"Want to add MessageListener to Programmatically create Queue forever"
To view the discussion, visit:
http://community.jboss.org/message/612425#612425
--------------------------------------------------------------
| |
I am creating JMS Queue at run time and trying to add Listener after creation of queue.
Now I am able to bind Listener with newly create queue. Here is my sample code to bind
Listener
Context ctx = new InitContex();
QueueConnectionFactory queueConnectionFactory =
(QueueConnectionFactory) ctx.lookup("java:/JmsXA");
Queue myQueue = (Queue)ctx.lookup("queue/myQueue");
QueueConnection queueConnection =
queueConnectionFactory.createQueueConnection();
QueueSessionqueueSession=queueConnection.createQueueSession(true,Session.AUTO_ACKNOWLEDGE);
javax.jms.QueueReceiver queueReceiver = queueSession.createReceiver(myQueue);
MessageListener myListener = new MyListenerBean();
queueReceiver.setMessageListener(myListener);
But using above code I need to bind Listener every time whenever I add new message in
Queue. Is there any way to bind Listener at once and use it till server didn't get
down.(This can be done with configure Queue in JBoss, But I want to bind Queue which I
have created at run time.)
Thanks in advance. |
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/612425#612425]
Start a new discussion in JBoss Messaging at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]