<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<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:"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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.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;}
span.hoenzb
        {mso-style-name:hoenzb;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Here&#8217;s the method I&#8217;m using to send the messages, the connection has already been established by this point&#8230;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:black">void send_batch(amqp_connection_state_t conn,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char const *queue_name,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int rate_limit,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int message_count)<br>
{<br>
&nbsp; uint64_t start_time = now_microseconds();<br>
&nbsp; int i;<br>
&nbsp; int sent = 0;<br>
&nbsp; int previous_sent = 0;<br>
&nbsp; uint64_t previous_report_time = start_time;<br>
&nbsp; uint64_t next_summary_time = start_time &#43; SUMMARY_EVERY_US;<br>
<br>
&nbsp; char message[256];<br>
&nbsp; amqp_bytes_t message_bytes;<br>
<br>
&nbsp; for (i = 0; i &lt; sizeof(message); i&#43;&#43;) {<br>
&nbsp;&nbsp;&nbsp; message[i] = i &amp; 0xff;<br>
&nbsp; }<br>
<br>
&nbsp; message_bytes.len = sizeof(message);<br>
&nbsp; message_bytes.bytes = message;<br>
<br>
&nbsp; for (i = 0; i &lt; message_count; i&#43;&#43;) {<br>
&nbsp;&nbsp;&nbsp; uint64_t now = now_microseconds();<br>
<br>
&nbsp;&nbsp;&nbsp; amqp_basic_properties_t props;<br>
&nbsp;&nbsp;&nbsp; props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG | AMQP_BASIC_DELIVERY_MODE_FLAG;<br>
&nbsp;&nbsp;&nbsp; props.content_type = amqp_cstring_bytes(&quot;text/plain&quot;);<br>
&nbsp;&nbsp;&nbsp; props.delivery_mode = 2; /* persistent delivery mode */<br>
&nbsp;&nbsp;&nbsp; die_on_error(amqp_basic_publish(conn,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 1,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; amqp_cstring_bytes(&quot;amq.direct&quot;),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; amqp_cstring_bytes(queue_name),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &amp;props,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; amqp_cstring_bytes(&quot;Hello world!&quot;)),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;Publishing&quot;);<br>
<br>
&nbsp;&nbsp;&nbsp; sent&#43;&#43;;<br>
&nbsp;&nbsp;&nbsp; if (now &gt; next_summary_time) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int countOverInterval = sent - previous_sent;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double intervalRate = countOverInterval / ((now - previous_report_time) / 1000000.0);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;%d ms: Sent %d - %d since last report (%d Hz)\n&quot;,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; (int)(now - start_time) / 1000, sent, countOverInterval, (int) intervalRate);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; previous_sent = sent;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; previous_report_time = now;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; next_summary_time &#43;= SUMMARY_EVERY_US;<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; while (((i * 1000000.0) / (now - start_time)) &gt; rate_limit) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; microsleep(2000);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; now = now_microseconds();<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp; }<br>
<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; uint64_t stop_time = now_microseconds();<br>
&nbsp;&nbsp;&nbsp; int total_delta = stop_time - start_time;<br>
<br>
&nbsp;&nbsp;&nbsp; printf(&quot;PRODUCER - Message count: %d\n&quot;, message_count);<br>
&nbsp;&nbsp;&nbsp; printf(&quot;Total time, milliseconds: %d\n&quot;, total_delta / 1000);<br>
&nbsp;&nbsp;&nbsp; printf(&quot;Overall messages-per-second: %g\n&quot;, (message_count / (total_delta / 1000000.0)));<br>
&nbsp; }<br>
}<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:150%"><span style="font-size:11.0pt;line-height:150%;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Alvaro Videla [mailto:videlalvaro@gmail.com]
<br>
<b>Sent:</b> 16 November 2011 16:58<br>
<b>To:</b> Nick Pateman<br>
<b>Cc:</b> rabbitmq-discuss@lists.rabbitmq.com<br>
<b>Subject:</b> Re: [rabbitmq-discuss] Messages disappearing<o:p></o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">If you post some sample code people might be able to help. Specifically the binding code and the publish code with routing keys.<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Also does the original code works as expected?<o:p></o:p></p>
<div>
<p class="MsoNormal">On Wed, Nov 16, 2011 at 5:55 PM, Nick Pateman &lt;<a href="mailto:nick.pateman@certivox.com">nick.pateman@certivox.com</a>&gt; wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hey there,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I&#8217;ve got a small application writing messages to a message queue.&nbsp; I basically modified an example taken from the C driver.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Anyway, I can see incoming and outgoing message rate increasing for the queue within the administration web page but I don&#8217;t currently have any application picking up the messages,
 they seem to be getting instantly delivered somewhere else.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">My rates jump from 0/0 to 10/10, 10 in a second and 10 out a second.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Any idea where my messages are going?&nbsp; I want to see the counters increase before I get my daemon running.&nbsp; Many thanks!<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:#888888">&nbsp;<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="color:#888888">Nick.<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
</body>
</html>