qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleksandr Rudyy <oru...@gmail.com>
Subject Re: Count number of messages
Date Mon, 26 Nov 2012 10:52:21 GMT
Hi Mat,

Could you please clarify what do you mean under "messages handled by
all the queues at any given time"?

Is it the total number of messages received by the queues, or the
total number of messages hold by the queues or messages
receive/delivery rates?

If any of the above, the  easiest way to get such information is to
use broker JMX API.
For example, you can get the value of total number of messages
received on virtual host by looking into attribute
"TotalMessagesReceived" on virtual host MBean.

Here is the sample JMX code, retrieving the value of
"TotalMessagesReceived" for virtual host "test" :

public static void main(String[] args) throws Exception
    {
        Map<String, Object> environment = new HashMap<String, Object>();

     environment.put(JMXConnector.CREDENTIALS, new String[] {"admin","admin"});
     JMXServiceURL url =  new
JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:8999/jmxrmi");
     JMXConnector jmxConnector = JMXConnectorFactory.connect(url, environment);
     MBeanServerConnection mbsc =  jmxConnector.getMBeanServerConnection();

     ObjectName virtualHost = new
ObjectName("org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=\"test\"");
     Long totalNumberOfMessagesOnVirtualHost =
(Long)mbsc.getAttribute(virtualHost, "TotalMessagesReceived");

     System.out.println("Number of messages:" +
totalNumberOfMessagesOnVirtualHost);

    }

Kind Regards,
Alex

On 26 November 2012 10:06, Matteo <spezam@gmail.com> wrote:
> Hello,
> in our infrastructure we are currently running Qpid java broker 0.12, with
> a pretty standard configuration.
>
> We have the need to connect our monitoring system to Qpid and count some
> metrics. In particular, we would like to know the total number of messages
> handled by all the queues at any given time.
>
> What is the easiest way to implement it.
>
> Thanks,
> Mat

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Mime
View raw message