1 Reply Latest reply on Jun 27, 2011 3:02 AM by navnath

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

    navnath Newbie

      HI There,

       

      Can any one suggect me how do I create JMS message queue at run time?

      I am verry very new to JMS message, So if any one know please explain me in steps.

      I am searching for this issue from last 9 days, but didn't got success.

       

      Thanks in advance...

        • 1. Re: How to Create JMS queue at run time using own java class?
          navnath Newbie

          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.