[rabbitmq-discuss] c amqp consumer frame header issue

Alan Antonuk alan.antonuk at gmail.com
Sat Jun 29 07:54:34 BST 2013


Its hard to say whats going on without knowing a bit more about whats going
on in the rest of your program.

It fails at frame.frame_type != AMQP_FRAME_HEADER, what is the value of
frame.frame_type when it fails?



On Fri, Jun 28, 2013 at 8:15 PM, cogitate <monish.unni at gmail.com> wrote:

> hi alan (antonuk):
> this particular logic for C consumers (experimental, from github) for
> rabbitmq aborts when pika based consumer, rabbitmq-java based consumer are
> able to drain the queue.
> from your github repo:
>  https://github.com/alanxz/rabbitmq-c
>
> it fails at this point:
>  if (frame.frame_type != AMQP_FRAME_HEADER) {
>       fprintf(stderr, "Expected header!");
>       abort();
>     }
>
> i'm not sure why?
>
>
> #include <stdio.h>
> #include <string.h>
>
> #include <stdint.h>
> #include <amqp.h>
> #include <amqp_framing.h>
>
> #include <assert.h>
>
> #include "utils.h"
>
> #define SUMMARY_EVERY_US 1000000
>
> static void run(amqp_connection_state_t conn)
> {
>   uint64_t start_time = now_microseconds();
>   int received = 0;
>   int previous_received = 0;
>   uint64_t previous_report_time = start_time;
>   uint64_t next_summary_time = start_time + SUMMARY_EVERY_US;
>
>   amqp_frame_t frame;
>   int result;
>   size_t body_received;
>   size_t body_target;
>
>   uint64_t now;
>
>   while (1) {
>     now = now_microseconds();
>     if (now > next_summary_time) {
>       int countOverInterval = received - previous_received;
>       double intervalRate = countOverInterval / ((now -
> previous_report_time) / 1000000.0);
>       printf("%d ms: Received %d - %d since last report (%d Hz)\n",
>          (int)(now - start_time) / 1000, received, countOverInterval, (int)
> intervalRate);
>
>       previous_received = received;
>       previous_report_time = now;
>       next_summary_time += SUMMARY_EVERY_US;
>     }
>
>     amqp_maybe_release_buffers(conn);
>     result = amqp_simple_wait_frame(conn, &frame);
>     if (result < 0)
>       return;
>
>     if (frame.frame_type != AMQP_FRAME_METHOD)
>       continue;
>
>     if (frame.payload.method.id != AMQP_BASIC_DELIVER_METHOD)
>       continue;
>
>     result = amqp_simple_wait_frame(conn, &frame);
>     if (result < 0)
>       return;
>
>     if (frame.frame_type != AMQP_FRAME_HEADER) {
>       fprintf(stderr, "Expected header!");
>       abort();
>     }
>
>
>
>
> --
> View this message in context:
> http://rabbitmq.1065348.n5.nabble.com/c-amqp-consumer-frame-header-issue-tp27685.html
> Sent from the RabbitMQ mailing list archive at Nabble.com.
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130628/ec011e39/attachment.htm>


More information about the rabbitmq-discuss mailing list