<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";}
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.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;}
@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">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/"><span style="color:blue">www.greenbutton.com</span></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"><span style="color:blue">peter.soukalopoulos@greenbutton.com</span></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="Picture_x0020_1" src="cid:image001.png@01CE6367.F7C55890" alt="Description: GreenButton_words_small">               <img border="0" width="276" height="70" id="Picture_x0020_2" src="cid:image002.jpg@01CE6367.F7C55890" 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"><span style="color:blue">help@greenbutton.com</span></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>