[rabbitmq-discuss] RabbitMQ-C: amqp_simple_rpc blocks waiting for frames already received
clint at rtcreativegroup.com
Thu Jul 21 15:09:54 BST 2011
I'm actually using the community supported C++ client available here: https://github.com/akalend/amqpcpp
As best as I can tell, that's the most current/up-to-date version. However, when I'm reading the source, I do see that it DOES NOT call the amqp_basic_* functions. Both the implementations of basic.get and basic.consume use the amqp_simple_rpc function. Is it possible there's a newer version of the C++ client that uses RabbitMQ-C's amqp_basic_* functions? Or do I need to build that myself?
On Jul 21, 2011, at 5:50 AM, David Wragg wrote:
> Clint Miller <clint at rtcreativegroup.com> writes:
>> I'm having a little trouble with the RabbitMQ-C library. I'm able to
>> declare exchanges, queues, setup bindings, and start the basic.consume
>> (amqp_simple_rpc function) method as I would expect.
> You are calling the amqp_basic_*, amqp_queue_* and amqp_exchange_*
> functions, right? amqp_simple_rpc is best thought of as an internal
> function, and calling it directly should never be necessary these days.
> None of the sample code in the tools/ and examples/ directories uses it.
>> But when a message is received by the consumer, I am able to observe
>> (via the debugger) the complete message (all the frames) being
>> processed. However, loop where multiple frames are linked together in
>> the amqp_simple_rpc function (labeled "retry:") never terminates, and
>> thus, at the end of what I think is a correct processing of all the
>> frames in the message, control goes back into the wait_frame_inner
>> function, where the recv function is called, anticipating more raw
>> data on the socket that isn't going to arrive.
> amqp_simple_rpc doesn't process incoming messages. If it gets an
> incoming frame that doesn't relate to the method, it stashes that frame
> away for later handling, and waits for the next frame (as the reply
> method frame should arrive sooner or later).
> To consume messages via basic.get, use amqp_basic_get and then
> amqp_simple_wait_frame to receive the body (see tools/get.c).
> To consume messages via basic.consume, use amqp_basic_consume and then
> call amqp_simple_wait_frame in a loop (see tools/consume.c and
> David Wragg
> Staff Engineer, RabbitMQ
> VMware, Inc.
More information about the rabbitmq-discuss