[rabbitmq-discuss] c amqp consumer frame header issue
cogitate
monish.unni at gmail.com
Sat Jun 29 04:15:54 BST 2013
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.
More information about the rabbitmq-discuss
mailing list