This content has been marked as final.
Show 5 replies
-
1. Re: Monitoring the depth of a Queue/Topic
genman Feb 20, 2007 7:25 PM (in response to mbabauer)Queue depth cannot be obtained using a standard JMS API. For JBoss MQ there is a JMX interface. For JBoss Messaging there is a compatible JMX interface.
I don't really see how you could make this app-server agnostic. As an example, SonicMQ has a proprietary API that you can use. ActiveMQ uses JMX. -
2. Re: Monitoring the depth of a Queue/Topic
mbabauer Feb 20, 2007 8:13 PM (in response to mbabauer)"genman" wrote:
I don't really see how you could make this app-server agnostic.
Well, you got me going in the right direction in any light. It was nice to dream of a world where one J2EE app could coexist peacefully with many an Ap Server. -
3. Re: Monitoring the depth of a Queue/Topic
jurivrljicak Feb 22, 2007 8:06 AM (in response to mbabauer)this way?
QueueBrowser browser = s.createBrowser(queue);
int depth= getDepth(browser);
private int getDepth(QueueBrowser browser) throws JMSException {
int i=0;
for(Enumeration e = browser.getEnumeration(); e.hasMoreElements(); ){
i++;
e.nextElement();
}
return i;
}
javax.jms api -
4. Re: Monitoring the depth of a Queue/Topic
timfox Feb 22, 2007 8:56 AM (in response to mbabauer)"jurivrljicak" wrote:
this way?
QueueBrowser browser = s.createBrowser(queue);
int depth= getDepth(browser);
private int getDepth(QueueBrowser browser) throws JMSException {
int i=0;
for(Enumeration e = browser.getEnumeration(); e.hasMoreElements(); ){
i++;
e.nextElement();
}
return i;
}
javax.jms api
This would probably be horribly slow - I wouldn't recommend it.
Also browsers are not mandated to provide a static snapshot of the queue, so the result won't necessarily exactly reflect the number of messages in the queue at any particular time. -
5. Re: Monitoring the depth of a Queue/Topic
exhilarator Apr 4, 2007 3:10 AM (in response to mbabauer)What is the JMX Interface which is mentioned to achieve this . Is there any way to use this in Spring Framework