On 12/17/2013 03:58 AM, skvsree wrote:
JMS doesn't really provide a mechanism for getting the queue depth. You could look at using the StatisticsBrokerPlugin to accomplish this: http://activemq.apache.org/statisticsplugin.htmlHi, I am trying to get the number of messages left in the queue, but I find it very tricky. Below is the code I am using, but the still the count is wrong. long qdepth = 0; var browser = _session.CreateBrowser(_queue); var messagesInQ = browser.GetEnumerator(); var list = new List<string>(); while (messagesInQ.MoveNext()) { var message = messagesInQ.Current as IMessage; if (message == null || list.Contains(message.NMSMessageId)) { break; } list.Add(message.NMSMessageId); qdepth++; }I am finding duplicate MessageIds as well in this case. -- View this message in context: http://activemq.2283324.n4.nabble.com/Get-Count-of-messages-in-the-queue-using-NMS-tp4675616.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.
-- Tim Bish Sr Software Engineer | RedHat Inc. [email protected] | www.fusesource.com | www.redhat.com skype: tabish121 | twitter: @tabish121 blog: http://timbish.blogspot.com/
