JBoss Community

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

created by Navnath Kumbhar in JBoss Messaging - View the full discussion

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

Start a new discussion in JBoss Messaging at Community