Hello,
I would like to count the message number received in a Queue with java program. I can see this with the Sonic soft, in the metric. Do I have to use the IMetric interface or a queue Listener?
Thanks
Look for the sonic management API,
Checkout
public interface IQueueData
If that works for you.
GetMessageCount() in IQueueData returns the number of messages currently held in the queue. I don't count every message.
It don't count each message, it gave the messages numbers, I tried this and it gave me the count of the message that was in there in the QUEUE at that point of time.
Try with this.
connector = CountMessage.getConnector("tcp://localhost:2506", "Administrator", "Administrator");
// create a proxy to the broker component
IBrokerProxy broker = CountMessage.getBrokerProxy(connector, "Domain1", "DomainManager", "MgmtBroker");
// get the queues
Object[] queues = broker.getQueues(null).toArray();
// list the queues and their message count
for (int i = 0; i
System.out.println(((IQueueData)queues[i]).getQueueName() + ", " + ((IQueueData)queues[i]).getMessageCount());
I don't want the message number in Queue but I want a listener which count the number message received.
manage the stateful object in the listener, and you can count the messages it processed since it started .
I am not sure, if that is what you are looking for.
The queue.messages.DeliveredPerSecond and queue.messages.ReceivedPerSecond metrics are averaged over the broker-wide collection interval, so you are unlikely to get what you want via metrics. What is the use case?
I want to create a java app for monitoring queues.
Are there particular aspects you are looking to monitor - e.g. queue depth, queue content?
No, I want only to know the message count received.