[jboss-user] [JBoss Messaging] - Re: How to Create JMS queue at run time using own java class?

Navnath Kumbhar do-not-reply at jboss.com
Mon Jun 27 03:02:10 EDT 2011


Navnath Kumbhar [http://community.jboss.org/people/navnath] created the discussion

"Re: How to Create JMS queue at run time using own java class?"

To view the discussion, visit: http://community.jboss.org/message/612041#612041

--------------------------------------------------------------
Got it............

Very very simple code to create JMS Queue at run time.....

try {
            String QName = "queueName";
            String createType = "createQueue";

            MBeanServer server = (MBeanServer) javax.management.MBeanServerFactory.findMBeanServer(
                    null).iterator().next();
            ObjectName ObjQueue = new ObjectName("jboss.mq:service=DestinationManager");

            // Passing Listener as String
            server.invoke(ObjQueue, createType, new Object[] { QName },
                    new String[] { "java.lang.String" });
        }catch(Throwable t) {
            t.printStackTrace();
        }


And you can see Queue is generated with name "queueName" and Listener for thia queue is String which you can use wahtever you want.
This code creates Queue under DestinationManager

Thanks.
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/612041#612041]

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/20110627/111cabe9/attachment-0001.html 


More information about the jboss-user mailing list