5 Replies Latest reply on Oct 30, 2014 11:55 AM by Justin Bertram

    Queue creation issue using HornetQ management API

    shyla_raj Newbie

      I am trying to create a queue using HornetQ management API. Queue gets created and it survives server restarts. But it doesnt appear on the management console.

      Also tried to look in the JBOSS server using jConsole.  A snapshot of jConsole view is pasted below.

      I can see my new queue 'testQueue4' visible under core-address and runtime-queue... but not under jms-queue.

       

      If there is a solution or workaround for this ..Please let me know. Thank you!

       

      Adding my code below as well:

       

      InitialContext initialContext = getInitialContext();

      QueueConnectionFactory cf = (QueueConnectionFactory) initialContext.lookup("jms/RemoteConnectionFactory");

      QueueConnection connection = cf.createQueueConnection(USERNAME, PASSWORD);

      QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

      connection.start();

       

      Message m = session.createMessage();

      JMSManagementHelper.putOperationInvocation(m, "jms.server", "createQueue", "testQueue4",  "jboss/exported/queue/testQueue4");

       

      Queue managementQueue = HornetQJMSClient.createQueue("hornetq.management");

      QueueRequestor requestor = new QueueRequestor(session, managementQueue);

      Message reply = requestor.request(m);

       

      boolean success = JMSManagementHelper.hasOperationSucceeded(reply);

      boolean response = (Boolean) JMSManagementHelper.getResult(reply);

      System.out.println("success: " + success + "; response: " + response);

       

      // Perfom a lookup on the queue just created

      Queue newQueue = (Queue) initialContext.lookup( "/queue/testQueue4");

      System.out.println("new Q name: " + newQueue.getQueueName());

       

      JConsole View

      Capture.PNG

        • 1. Re: Queue creation issue using HornetQ management API
          Justin Bertram Master

          Are you using Wildfly or HornetQ standalone?

          • 2. Re: Queue creation issue using HornetQ management API
            shyla_raj Newbie

            We use embedded hornetq on jboss EAP 6.1

            Thanks!

            • 3. Re: Queue creation issue using HornetQ management API
              Justin Bertram Master

              You've got is a mismatch in how you're managing HornetQ.  You're using the HornetQ management API directly to create the queue.  However, you're using the Wildfly MBeans via JConsole to inspect it.  The problem is that changes made via the HornetQ management API are not reflected in the Wildfly management interfaces (e.g. MBeans, CLI, XML, HTTP interface, etc.).  You need to pick one method of server management and stick with that.  Either activate the HornetQ MBeans and inspect those via JConsole when you use the HornetQ management API, or use the Wildfly native management API and continue using the MBeans you're currently using.

              • 4. Re: Queue creation issue using HornetQ management API
                Alex Khvatov Newbie

                Thank you, Justin for your reply. However we are not using Wildfly. The server running on our dev box is Jboss EAP 6.1 with 'messaging' enabled. We use the same server in the client to launch jConsole from (to get same jars available on the classpath via bin\jconsole.bat).
                If I understand you correctly we should not be mixing the way we manage the server (web management console + jConsole + using the managment API) and expect things to be visible everywhere. Is this what you mean?

                 

                Sincerely,

                Alex

                • 5. Re: Queue creation issue using HornetQ management API
                  Justin Bertram Master

                  However we are not using Wildfly.

                  It doesn't matter that you aren't using Wildfly, per se.  JBoss EAP 6.x behaves the same way.

                   

                  If I understand you correctly we should not be mixing the way we manage the server (web management console + jConsole + using the managment API) and expect things to be visible everywhere. Is this what you mean?

                  What I mean is that you should not be mixing between the application server's management functionality and HornetQ's own management functionality as changes made via one may or may not be visible from the other.  In your case I would recommend you standardize on the application server's management interfaces (e.g. web console, CLI, MBeans, etc.) as any changes made there are then written to the XML and also visible from each of the other application server management interfaces.