Hi,
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.