<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:"Calibri","sans-serif";color:#1F497D">Here’s the method I’m using to send the messages, the connection has already been established by this point…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black">void send_batch(amqp_connection_state_t conn,<br>
char const *queue_name,<br>
int rate_limit,<br>
int message_count)<br>
{<br>
uint64_t start_time = now_microseconds();<br>
int i;<br>
int sent = 0;<br>
int previous_sent = 0;<br>
uint64_t previous_report_time = start_time;<br>
uint64_t next_summary_time = start_time + SUMMARY_EVERY_US;<br>
<br>
char message[256];<br>
amqp_bytes_t message_bytes;<br>
<br>
for (i = 0; i < sizeof(message); i++) {<br>
message[i] = i & 0xff;<br>
}<br>
<br>
message_bytes.len = sizeof(message);<br>
message_bytes.bytes = message;<br>
<br>
for (i = 0; i < message_count; i++) {<br>
uint64_t now = now_microseconds();<br>
<br>
amqp_basic_properties_t props;<br>
props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG | AMQP_BASIC_DELIVERY_MODE_FLAG;<br>
props.content_type = amqp_cstring_bytes("text/plain");<br>
props.delivery_mode = 2; /* persistent delivery mode */<br>
die_on_error(amqp_basic_publish(conn,<br>
1,<br>
amqp_cstring_bytes("amq.direct"),<br>
amqp_cstring_bytes(queue_name),<br>
0,<br>
0,<br>
&props,<br>
amqp_cstring_bytes("Hello world!")),<br>
"Publishing");<br>
<br>
sent++;<br>
if (now > next_summary_time) {<br>
int countOverInterval = sent - previous_sent;<br>
double intervalRate = countOverInterval / ((now - previous_report_time) / 1000000.0);<br>
printf("%d ms: Sent %d - %d since last report (%d Hz)\n",<br>
(int)(now - start_time) / 1000, sent, countOverInterval, (int) intervalRate);<br>
<br>
previous_sent = sent;<br>
previous_report_time = now;<br>
next_summary_time += SUMMARY_EVERY_US;<br>
}<br>
<br>
while (((i * 1000000.0) / (now - start_time)) > rate_limit) {<br>
microsleep(2000);<br>
now = now_microseconds();<br>
}<br>
}<br>
<br>
{<br>
uint64_t stop_time = now_microseconds();<br>
int total_delta = stop_time - start_time;<br>
<br>
printf("PRODUCER - Message count: %d\n", message_count);<br>
printf("Total time, milliseconds: %d\n", total_delta / 1000);<br>
printf("Overall messages-per-second: %g\n", (message_count / (total_delta / 1000000.0)));<br>
}<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:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> 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> </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> </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 <<a href="mailto:nick.pateman@certivox.com">nick.pateman@certivox.com</a>> 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"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I’ve got a small application writing messages to a message queue. 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"> <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’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"> <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"> <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? I want to see the counters increase before I get my daemon running. 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"> <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> </o:p></p>
</div>
</div>
</body>
</html>