1 Reply Latest reply on Jun 17, 2010 4:18 AM by jmesnil

    Retrieving attributes for a JMS Queue - Did the call succeed or fail?

    aengineer

      How do you find out if a call to retrieve a attribute via the management API failed? For example, in the below sample code, the method "hasOperationSuceeded" always returns false.

       

      Message message = session.createMessage();
      JMSManagementHelper.putAttribute(message, "jms.queue.ExampleQueue", "messageCount");
      Message reply = requestor.request(message);
      Object o = JMSManagementHelper.getResult(reply);
      if (JMSManagementHelper.hasOperationSucceeded(reply)) {
          log.info("There are " + o.toString() + " messages in queue [" + "jms.queue.ExampleQueue" + "]");   
      } else {
          log.error("Failed: Management response is [" + o.toString() + "]");
      }

       

      On a side note, should one be using the management API, or should one be using the JMX API to do these kinds of activities?

       

      Thanks

      Aspi Engineer

        • 1. Re: Retrieving attributes for a JMS Queue - Did the call succeed or fail?
          jmesnil

          Aspi Engineer wrote:

           

          How do you find out if a call to retrieve a attribute via the management API failed? For example, in the below sample code, the method "hasOperationSuceeded" always returns false.

          This is indeed a bug: I just fixed it in the trunk https://jira.jboss.org/browse/HORNETQ-420

           

          On a side note, should one be using the management API, or should one be using the JMX API to do these kinds of activities?

          You can achieve the same results using either the management API or JMX. I prefer to use JMX as it is more straightforward but ymmv.

           

          thanks for the report,

          jeff