[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 =


        javax.jms.QueueReceiver queueReceiver = queueSession.createReceiver(myQueue); 
        MessageListener myListener = new MyListenerBean();

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

Start a new discussion in JBoss Messaging at Community

-------------- 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