[rabbitmq-discuss] Is it possible to retrieve the number of unacked messages on a queue?

Peter Soukalopoulos peter at greenbutton.com
Thu Jun 6 23:15:43 BST 2013


I’ve done a little searching via Google to retrieve the number of Unacked
messages via the RabbitMQ client API. Most threads say it’s not possible.



Does anyone have an explanation or, even better, a solution?



FYI I’m using C# .Net – this code returns the number of Ready messages.



        public int GetApproximateCount(string queueName)

        {

            using (var connection = CreateConnection())

            using (var model = connection.CreateModel())

            {

                try

                {

                    var result = model.QueueDeclarePassive(queueName);

                    return (int)result.MessageCount;

                }

                catch (OperationInterruptedException)

                {

                    return 0;

                }

            }

        }



*Regards,*

*Peter*



*Peter** **Soukalopoulos*
*Development Team Leader | **GreenButton Limited *| www.greenbutton.com
Level 2, James Smith Building, 55 Cuba Street, Wellington, New Zealand
Mobile: +64 22 632 5023| DDI: +644 974 6602 |
peter.soukalopoulos at greenbutton.com | Skype: psoukal | HQ: +644 499 0424

[image: Description: GreenButton_words_small]               [image:
cid:image003.jpg at 01CC4E01.BA075BC0]

For best support, please respond to help at greenbutton.com and retain the
ticket number in the subject line.



This message contains confidential information, intended only for
the person(s) named above, which may also be privileged. Any use,
distribution, copying or disclosure by any other person is strictly
prohibited. In such case, you should delete this message and kindly notify
the sender via reply e-mail. Please advise immediately if you or your
employer does not consent to Internet e-mail for messages of this kind.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130607/9260c951/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 7433 bytes
Desc: not available
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130607/9260c951/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 3761 bytes
Desc: not available
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130607/9260c951/attachment.jpeg>


More information about the rabbitmq-discuss mailing list