6 Replies Latest reply on Aug 8, 2012 9:38 AM by Gerald Weber

    Management core API - hangs

    Gerald Weber Newbie

      Hi,

       

      what coul be the reason that this code hangs at "ClientMessage reply = requestor.request(m);"

       

      {code}

      requestor = new ClientRequestor(session,ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS);

      ClientMessage m = session.createMessage(false);

      ManagementHelper.putAttribute(m, ResourceNames.CORE_QUEUE+q, "countMessages");

      //ManagementHelper.putOperationInvocation(m, ResourceNames.CORE_QUEUE+q, "listMessageCounter");

      //ManagementHelper.putOperationInvocation(m, ResourceNames.CORE_QUEUE+q, "countMessages");

      ClientMessage reply = requestor.request(m);

      int count = (Integer) ManagementHelper.getResult(reply);

      {code}

       

      It's basically taken from the documentation, chapter 30.3

        • 1. Re: Management core API - hangs
          Jeff Mesnil Master

          Gerald Weber wrote:

           

          Hi,

           

          what coul be the reason that this code hangs at "ClientMessage reply = requestor.request(m);"

           

          {code}

          ManagementHelper.putAttribute(m, ResourceNames.CORE_QUEUE+q, "countMessages");

          {code}

           

          It's basically taken from the documentation, chapter 30.3

          "countMessage" is an operation, not an attribute. Try with the "messageCount" attribute instead.

           

          In any case, it should still have sent a message telling you that there is no such attribute.

          Could you copy the log / stack trace in HornetQ server logs?

           

          thanks

          • 2. Re: Management core API - hangs
            Gerald Weber Newbie

            Hi,

             

            yes,sorry, i tried around with different attributes.

            i had "messageCount" before but that doesnt change anything.

             

            i dont have any logs, i'm using an embedded server with core api only and the call hangs at ..request.. forever without any error

             

            When i change putattribute to  "ManagementHelper.putOperationInvocation(m, ResourceNames.CORE_QUEUE+q, "countMessages");"

            (as in the queuecontrolusingcoretest.java) i get

             

            Warnung: exception while invoking countMessages on core.queue.jms.queue.hornetq.management.c46c197e-d25c-422b-a14f-000f528ec641

            java.lang.IllegalArgumentException: no operation countMessages/0

            • 3. Re: Management core API - hangs
              Justin Bertram Master

              You should probabaly call session.start().  I think the documentation left that out.

              • 4. Re: Management core API - hangs
                Gerald Weber Newbie

                Jesus, thats it..thanks Justin !

                 

                Now i have to find out why ManagementHelper.putOperationInvocation(m, ResourceNames.CORE_QUEUE+q, "listMessages"); says "no operation listMessages/0"...

                • 5. Re: Management core API - hangs
                  Jeff Mesnil Master

                  Gerald Weber wrote:

                   

                  Jesus, thats it..thanks Justin !

                   

                  Now i have to find out why ManagementHelper.putOperationInvocation(m, ResourceNames.CORE_QUEUE+q, "listMessages"); says "no operation listMessages/0"...

                  The error message is cryptic It means that HornetQ couldn't find a listMessages with 0 parameters. Indeed, looking at the javadoc, you must pass a filter (or null or "" to list all messages).

                   

                  ManagementHelper.putOperationInvocation(m, ResourceNames.CORE_QUEUE+q, "listMessages", null);

                   

                  should do the trick

                  1 of 1 people found this helpful
                  • 6. Re: Management core API - hangs
                    Gerald Weber Newbie

                    thanks again,works now !