[jboss-user] [JBoss Messaging] - Want to add MessageListener to Programmatically create Queue forever

Navnath Kumbhar do-not-reply at jboss.com
Wed Jun 29 00:28:23 EDT 2011


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&containerType=14&container=2042]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110629/7d320b63/attachment.html 


More information about the jboss-user mailing list