<div dir="ltr"><div style>Its hard to say whats going on without knowing a bit more about whats going on in the rest of your program.</div><div style><br></div><div style>It fails at frame.frame_type != AMQP_FRAME_HEADER, what is the value of frame.frame_type when it fails?</div>
<div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jun 28, 2013 at 8:15 PM, cogitate <span dir="ltr">&lt;<a href="mailto:monish.unni@gmail.com" target="_blank">monish.unni@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hi alan (antonuk):<br>
this particular logic for C consumers (experimental, from github) for<br>
rabbitmq aborts when pika based consumer, rabbitmq-java based consumer are<br>
able to drain the queue.<br>
from your github repo:<br>
�<a href="https://github.com/alanxz/rabbitmq-c" target="_blank">https://github.com/alanxz/rabbitmq-c</a><br>
<br>
it fails at this point:<br>
�if (frame.frame_type != AMQP_FRAME_HEADER) {<br>
� � � fprintf(stderr, &quot;Expected header!&quot;);<br>
� � � abort();<br>
� � }<br>
<br>
i&#39;m not sure why?<br>
<br>
<br>
#include &lt;stdio.h&gt;<br>
#include &lt;string.h&gt;<br>
<br>
#include &lt;stdint.h&gt;<br>
#include &lt;amqp.h&gt;<br>
#include &lt;amqp_framing.h&gt;<br>
<br>
#include &lt;assert.h&gt;<br>
<br>
#include &quot;utils.h&quot;<br>
<br>
#define SUMMARY_EVERY_US 1000000<br>
<br>
static void run(amqp_connection_state_t conn)<br>
{<br>
� uint64_t start_time = now_microseconds();<br>
� int received = 0;<br>
� int previous_received = 0;<br>
� uint64_t previous_report_time = start_time;<br>
� uint64_t next_summary_time = start_time + SUMMARY_EVERY_US;<br>
<br>
� amqp_frame_t frame;<br>
� int result;<br>
� size_t body_received;<br>
� size_t body_target;<br>
<br>
� uint64_t now;<br>
<br>
� while (1) {<br>
� � now = now_microseconds();<br>
� � if (now &gt; next_summary_time) {<br>
� � � int countOverInterval = received - previous_received;<br>
� � � double intervalRate = countOverInterval / ((now -<br>
previous_report_time) / 1000000.0);<br>
� � � printf(&quot;%d ms: Received %d - %d since last report (%d Hz)\n&quot;,<br>
� � � � �(int)(now - start_time) / 1000, received, countOverInterval, (int)<br>
intervalRate);<br>
<br>
� � � previous_received = received;<br>
� � � previous_report_time = now;<br>
� � � next_summary_time += SUMMARY_EVERY_US;<br>
� � }<br>
<br>
� � amqp_maybe_release_buffers(conn);<br>
� � result = amqp_simple_wait_frame(conn, &amp;frame);<br>
� � if (result &lt; 0)<br>
� � � return;<br>
<br>
� � if (frame.frame_type != AMQP_FRAME_METHOD)<br>
� � � continue;<br>
<br>
� � if (<a href="http://frame.payload.method.id" target="_blank">frame.payload.method.id</a> != AMQP_BASIC_DELIVER_METHOD)<br>
� � � continue;<br>
<br>
� � result = amqp_simple_wait_frame(conn, &amp;frame);<br>
� � if (result &lt; 0)<br>
� � � return;<br>
<br>
� � if (frame.frame_type != AMQP_FRAME_HEADER) {<br>
� � � fprintf(stderr, &quot;Expected header!&quot;);<br>
� � � abort();<br>
� � }<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://rabbitmq.1065348.n5.nabble.com/c-amqp-consumer-frame-header-issue-tp27685.html" target="_blank">http://rabbitmq.1065348.n5.nabble.com/c-amqp-consumer-frame-header-issue-tp27685.html</a><br>

Sent from the RabbitMQ mailing list archive at Nabble.com.<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><br>
</blockquote></div><br></div>