<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><meta name="Generator" content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
h1
        {mso-style-priority:9;
        mso-style-link:"Heading 1 Char";
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:24.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.Heading1Char
        {mso-style-name:"Heading 1 Char";
        mso-style-priority:9;
        mso-style-link:"Heading 1";
        font-weight:bold;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang="EN-US" link="blue" vlink="purple"><div class="WordSection1"><p class="MsoNormal"><span style="color:#1f497d">Found the solution using the RabbitMQ Management HTTP API /api/queues/%F/queue which returns a JSON response including values for messages_ready, messages_unacknowledged and messages.</span></p>
<p class="MsoNormal"><span style="color:#1f497d"> </span></p><p class="MsoNormal"><span style="color:#1f497d">{</span></p><p class="MsoNormal"><span style="color:#1f497d">    &quot;memory&quot;: 18104,</span></p><p class="MsoNormal">
<span style="color:#1f497d">    &quot;idle_since&quot;: &quot;2013-06-05 21:42:17&quot;,</span></p><p class="MsoNormal"><span style="color:#1f497d">    &quot;exclusive_consumer_tag&quot;: &quot;&quot;,</span></p><p class="MsoNormal">
<span style="color:#1f497d">    &quot;messages_ready&quot;: 2,</span></p><p class="MsoNormal"><span style="color:#1f497d">    &quot;messages_unacknowledged&quot;: 0,</span></p><p class="MsoNormal"><span style="color:#1f497d">    &quot;messages&quot;: 2,</span></p>
<p class="MsoNormal"><span style="color:#1f497d">    &quot;consumers&quot;: 0,</span></p><p class="MsoNormal"><span style="color:#1f497d">    &quot;slave_nodes&quot;: [],</span></p><p class="MsoNormal"><span style="color:#1f497d">    &quot;backing_queue_status&quot;: {</span></p>
<p class="MsoNormal"><span style="color:#1f497d">        &quot;q1&quot;: 0,</span></p><p class="MsoNormal"><span style="color:#1f497d">        &quot;q2&quot;: 0,</span></p><p class="MsoNormal"><span style="color:#1f497d">        &quot;delta&quot;: [</span></p>
<p class="MsoNormal"><span style="color:#1f497d">            &quot;delta&quot;,</span></p><p class="MsoNormal"><span style="color:#1f497d">            &quot;undefined&quot;,</span></p><p class="MsoNormal"><span style="color:#1f497d">            0,</span></p>
<p class="MsoNormal"><span style="color:#1f497d">            &quot;undefined&quot;</span></p><p class="MsoNormal"><span style="color:#1f497d">        ],</span></p><p class="MsoNormal"><i><span style="color:#1f497d">..stuff deleted</span></i></p>
<p class="MsoNormal"><span style="color:#1f497d">}</span></p><p class="MsoNormal"><span style="color:#1f497d"> </span></p><p class="MsoNormal"><span style="color:#1f497d">See </span><a href="http://hg.rabbitmq.com/rabbitmq-management/raw-file/3646dee55e02/priv/www-api/help.html">http://hg.rabbitmq.com/rabbitmq-management/raw-file/3646dee55e02/priv/www-api/help.html</a><span style="color:#1f497d"></span></p>
<p class="MsoNormal"><span style="color:#1f497d"> </span></p><div><p class="MsoNormal"><i><span lang="EN-NZ" style="color:#1f497d">Regards,</span></i></p><p class="MsoNormal"><i><span lang="EN-NZ" style="color:#1f497d">Peter</span></i></p>
<p class="MsoNormal"><span lang="EN-NZ" style="color:#1f497d"> </span></p><p class="MsoNormal"><b><span lang="EN-NZ" style="font-size:13.5pt;color:gray">Peter</span></b><b><span lang="EN-NZ" style="font-size:13.5pt;color:#4181c0"> </span></b><b><span lang="EN-NZ" style="font-size:13.5pt;color:#82823f">Soukalopoulos</span></b><span lang="EN-NZ" style="color:#1f497d"> <br>
</span><b><span lang="EN-NZ" style="font-size:7.5pt;color:#5f5f5f">Development Team Leader | </span></b><b><span lang="EN-NZ" style="font-size:7.5pt;color:#3f621f">GreenButton Limited </span></b><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d">| <a href="http://www.greenbutton.com/">www.greenbutton.com</a><br>
</span><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d">Level 2, James Smith Building, 55 Cuba Street, Wellington, New Zealand</span><span lang="EN-NZ" style="color:#1f497d"> </span><span lang="EN-NZ" style="color:#1f497d"><br>
</span><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d">Mobile: +64 22 632 5023</span><span lang="EN-NZ" style="font-size:7.0pt;color:black">| </span><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d">DDI</span><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d">: +644 974 6602</span><span lang="EN-NZ" style="font-size:7.0pt;color:black"> </span><span lang="EN-NZ" style="font-size:7.5pt;color:#008250">|</span><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d"> <a href="mailto:peter.soukalopoulos@greenbutton.com">peter.soukalopoulos@greenbutton.com</a></span><span lang="EN-NZ" style="color:#1f497d"> </span><span lang="EN-NZ" style="font-size:7.0pt;color:black">| </span><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d">Skype</span><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d">: psoukal | </span><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d">HQ</span><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d">: +644 499 0424</span><span lang="EN-NZ" style="font-size:7.0pt;color:black"></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#1f497d"><img border="0" width="121" height="58" id="_x0000_i1028" src="cid:image001.png@01CE638B.3C515450" alt="Description: GreenButton_words_small">               <img border="0" width="276" height="70" id="_x0000_i1027" src="cid:image002.jpg@01CE638B.3C515450" alt="cid:image003.jpg@01CC4E01.BA075BC0"></span><span lang="EN-NZ" style="color:#1f497d"><br>
<br></span><span lang="EN-NZ" style="color:#1f497d"></span></p><p class="MsoNormal"><span lang="EN-NZ" style="font-size:9.0pt;color:#1f497d">For best support, please respond to <a href="mailto:help@greenbutton.com">help@greenbutton.com</a> and retain the ticket number in the subject line.</span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#1f497d"> </span></p><p class="MsoNormal"><span style="font-size:9.0pt;color:#1f497d">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.</span><span lang="EN-NZ" style="color:#1f497d"></span></p>
</div><p class="MsoNormal"><span style="color:#1f497d"> </span></p><div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Peter Soukalopoulos [mailto:<a href="mailto:peter@greenbutton.com">peter@greenbutton.com</a>] <br>
<b>Sent:</b> Friday, 7 June 2013 10:16 a.m.<br><b>To:</b> &#39;<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a>&#39;<br><b>Subject:</b> Is it possible to retrieve the number of unacked messages on a queue?</span></p>
</div></div><p class="MsoNormal"> </p><p class="MsoNormal">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.</p><p class="MsoNormal">
 </p><p class="MsoNormal">Does anyone have an explanation or, even better, a solution?</p><p class="MsoNormal"> </p><p class="MsoNormal">FYI I’m using C# .Net – this code returns the number of Ready messages.</p><p class="MsoNormal">
 </p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">        </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">public</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">int</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> GetApproximateCount(</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">string</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> queueName)</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">        {</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">            </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">using</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> (</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">var</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> connection = CreateConnection())</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">            </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">using</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> (</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">var</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> model = connection.CreateModel())</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">            {</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">                </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">try</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">                {</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">                    </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">var</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> result = model.QueueDeclarePassive(queueName);</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">                    </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">return</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> (</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">int</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">)result.MessageCount;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">                }</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">                </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">catch</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> (</span><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af;background:white">OperationInterruptedException</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">)</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">                {</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">                    </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">return</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> 0;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">                }</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">            }</span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white">        }</span></p><p class="MsoNormal"> </p><p class="MsoNormal"><i><span lang="EN-NZ" style="color:#1f497d">Regards,</span></i></p>
<p class="MsoNormal"><i><span lang="EN-NZ" style="color:#1f497d">Peter</span></i></p><p class="MsoNormal"><span lang="EN-NZ" style="color:#1f497d"> </span></p><p class="MsoNormal"><b><span lang="EN-NZ" style="font-size:13.5pt;color:gray">Peter</span></b><b><span lang="EN-NZ" style="font-size:13.5pt;color:#4181c0"> </span></b><b><span lang="EN-NZ" style="font-size:13.5pt;color:#82823f">Soukalopoulos</span></b><span lang="EN-NZ" style="color:#1f497d"> <br>
</span><b><span lang="EN-NZ" style="font-size:7.5pt;color:#5f5f5f">Development Team Leader | </span></b><b><span lang="EN-NZ" style="font-size:7.5pt;color:#3f621f">GreenButton Limited </span></b><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d">| <a href="http://www.greenbutton.com/">www.greenbutton.com</a><br>
</span><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d">Level 2, James Smith Building, 55 Cuba Street, Wellington, New Zealand</span><span lang="EN-NZ" style="color:#1f497d"> </span><span lang="EN-NZ" style="color:#1f497d"><br>
</span><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d">Mobile: +64 22 632 5023</span><span lang="EN-NZ" style="font-size:7.0pt;color:black">| </span><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d">DDI: +644 974 6602</span><span lang="EN-NZ" style="font-size:7.0pt;color:black"> </span><span lang="EN-NZ" style="font-size:7.5pt;color:#008250">|</span><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d"> <a href="mailto:peter.soukalopoulos@greenbutton.com">peter.soukalopoulos@greenbutton.com</a></span><span lang="EN-NZ" style="color:#1f497d"> </span><span lang="EN-NZ" style="font-size:7.0pt;color:black">| </span><span lang="EN-NZ" style="font-size:7.5pt;color:#1f497d">Skype: psoukal | HQ: +644 499 0424</span><span lang="EN-NZ" style="font-size:7.0pt;color:black"></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:9.0pt;color:#1f497d"><img border="0" width="121" height="58" id="Picture_x0020_1" src="cid:image001.png@01CE638B.3C515450" alt="Description: GreenButton_words_small">               <img border="0" width="276" height="70" id="Picture_x0020_2" src="cid:image002.jpg@01CE638B.3C515450" alt="cid:image003.jpg@01CC4E01.BA075BC0"></span><span lang="EN-NZ" style="color:#1f497d"></span></p>
<p class="MsoNormal"><span lang="EN-NZ" style="font-size:9.0pt;color:#1f497d">For best support, please respond to <a href="mailto:help@greenbutton.com">help@greenbutton.com</a> and retain the ticket number in the subject line.</span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#1f497d"> </span></p><p class="MsoNormal"><span style="font-size:9.0pt;color:#1f497d">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.</span><span lang="EN-NZ" style="color:#1f497d"></span></p>
<p class="MsoNormal"> </p></div></body></html>