JBoss Community

Negative MessageCount

created by Noa Drach in JBoss Messaging - View the full discussion

We have a part in my code that queries a queue once in an hour to get it's size.

 

this is the code e used

 

MBeanServer mBeanServer = MBeanServerLocator.locateJBoss();
 
 
 
ObjectName serverObjectName = new ObjectName("jboss.messaging.destination:service=Queue,name=" + queueName);
 
Integer messagesInQueue = (Integer) mBeanServer.getAttribute(serverObjectName, "MessageCount");
 
return messagesInQueue.intValue() ;
 
 

 

and we keep the data in the DB.

 

from looking into the data kept we see that sometimes we receive negative values.

 

in https://jira.jboss.org/browse/JBMESSAGING-926?focusedCommentId=12356514&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel We saw a discussion about this issue but it describes a scenario of calling removeAllMessage. In our case we don't interfere with the queues work messages are sent by the producer and handled by the receivers.

 

we are using Messaging 1.4.5.GA

 

I have 2 questions:

  1. Is there an explanation for the negative values?
  2. Can We trust the values given when they aren't negative?

 

Thanks,

Noa

Reply to this message by going to Community

Start a new discussion in JBoss Messaging at Community