1 Reply Latest reply on Jun 10, 2012 12:12 PM by sanjayssn

    Check if a JMS Queue exists before creating one

    sanjayssn

      Hi,

       

      I am new to Jboss. I am using v 7.1.1. I am able to create hornetq queues dynamically using the JMX Api as follows.

       

      JMXServiceURL serviceURL = new JMXServiceURL(urlString);

              JMXConnector jmxConnector = JMXConnectorFactory.connect(serviceURL, null);

              MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();

      .............

      connection.invoke(queueBeanObject, "addJmsQueue", params, signature);

       

      I am trying to find out the best method to check if a queue exists, before creating one. I am NOT supposed to have any dependency on the hornetq server name or jboss specific naming like 'subsystem=messaging, hornetq-server=default'. So i cannot use the isRegistered() method available in the JMX API, to check if the objectName is registered.

       

       

      So my question : Is there any possbility for me to check the existence of a JMS queue, by using the queue name alone ? (Not ObjectName of the Mbean).... I am open to use any of the Management API stuff and NOT restricted to JMX.

       

      Thanks,

      Sanjay