3 Replies Latest reply on Aug 26, 2010 8:38 AM by andreas_back

    How to delete a dynamically created queue?

    andreas_back

      Hello!

       

      As a workaround for https://jira.jboss.org/browse/HORNETQ-469 we have decided to use programmatically generated (non-temporary) JMS-Queues that are registered within JMX. We

       

      0.     process a servlet request and call a remote method

      1.     to create the queue (within a SLB in JBoss),

      2.     wait in the servlet request for a message arriving on it,

      3.     send a message to it from a MDB in JBoss,

      4.     receive the message in the servlet request and

      5.     delete the queue.

       

      If the server crashes between step 1 and step 5 then the queue is at the moment not deleted. That is not a point in HorentQ of course, just in the application logic. Before extending our application specific administration tool we want to ask if there is already an existing solution.

       

      Questions:         Can a JMS-queue that is registered in JMX be deleted by the use of the JMX-Console?

                               Is a utility available that allows to delete a JMS queue?

       

      With best regards,

       

      Andreas

        • 1. Re: How to delete a dynamically created queue?
          jbmuser

          Delete Programatically

          ----------------------------------------

          String jmxUrl = "service:jmx:rmi:///jndi/rmi://" + host + ":" + jmxPort + "/jmxrmi";
          JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(jmxUrl), new HashMap());
          MBeanServerConnection conn = connector.getMBeanServerConnection();

          ObjectName name=new ObjectName("org.hornetq:module=JMS,type=Server");

          JMSServerControl control = (JMSServerControl)MBeanServerInvocationHandler.newProxyInstance(mbsc,name,JMSServerControl.class,false);  

          control.destroyQueue(queueName);

           

          Delete Using JMX console

          ----------------------------------------

          See attached.

          • 2. Re: How to delete a dynamically created queue?
            timfox

            +1

             

            Also, third way - can delete by sending a management message on the normal connection (no JMX required)

            1 of 1 people found this helpful
            • 3. Re: How to delete a dynamically created queue?
              andreas_back

              Hello Bijith and Tim,

               

              thank you for your response!

               

              The application specific administration tool has been extended by the possibility to delete the dynamically created queues programmatically by using the JMX solution. This allowed it to restrict the naming pattern of the queues that can be deleted. It was a little bit tricky to find the correct JMX-URL-pattern, but it

               

                   https://jira.jboss.org/browse/JBAS-3885

               

              had it also.

               

              With best regards,

               

              Andreas