Counting Queue messages

Dec 26, 2013 at 12:31 PM
Hi,
Is there is anyway to count the number of messages in queue without touching them.
Thanks for your great library.
Coordinator
Dec 26, 2013 at 1:46 PM
Hi Rahman

Its possible
protected int GetMessageCount(MessageQueue q)
{
var filter = new MessagePropertyFilter()
                 {
                     AdministrationQueue = false,
                     ArrivedTime = false,
                     CorrelationId = false,
                     Priority = false,
                     ResponseQueue = false,
                     SentTime = false,
                     Body = false,
                     Label = false,
                     Id = false
                 };
q.MessageReadPropertyFilter = filter;
return q.GetAllMessages().Length;
}

But I have not included this function in my DLL.

Thanks and Regards
Prashant Thakre
Dec 29, 2013 at 5:01 AM
Edited Dec 31, 2013 at 11:38 AM
Hi Prashant,
Thanks for the input.