[rabbitmq-discuss] rabbitmq-c for a reliable rabbitmq client in production environment.

Alan Antonuk alan.antonuk at gmail.com
Tue Jan 17 15:52:38 GMT 2012

Responses inlined

On Mon, Jan 16, 2012 at 5:02 AM, TZHA <sophiewenxizhang at googlemail.com>wrote:

> Hi,
> i am working with rabbitmq-c (downloaded from github/newest version -
> cmake/VS2010 rebuild under windows) and would like to prepare a
> rabbitmq/c/c++ based solution for a production environment.
> However for a real application, we still have some reliability
> requirements that are apparently not yet supported by rabbitmq-c.
> The first requirement is to get “cancellation notification” in case,
> e.g. whenever a queue is down – so that the client/consumer can
> reconnect to the broker.
> For this purpose – as I understood, the client has to send  the
> “client-capabilities” with
>   ...
>   consumer_cancel_notify = true,
>   publisher_confirms = true
> For the consumer_cancel_notify - the client does need to tell the broker
that it wants to turn this on.

For the publisher_confirms - the client is not required to tell the broker
to enable this.  To enabled it on a channel you should send send a
confirm.select to enable publisher_confirms for a channel. You can send the
client capabilities to query the broker to see if it supports this
extension before continuing connecting to a broker.

For some more info how rabbit supports these extensions:

for the connection setup. In  case of of rabbitmq-c, I saw that one
> shall set the capabilities in amqp_login (amqp_socket.c)  method.
> Current this is set to NULL.
>  amqp_connection_open_t s
>  s.capabilities.len = 0;
>  s.capabilities.bytes = NULL;

The format of that field is I believe a shortstr.  However that's not where
you want to send capabilities.  When you get the connection.start method
from the broker, you need to examine the server-properties (which is a
table) parameter to see if the broker supports the extensions you want.
 When you respond with a connection.start-ok, you need to put the
extensions you want to enable in the client-properties parameter, which is
also a table.

> Can some expert tell me what kind of syntax can be used for the
> s.capabilities.bytes field?
> The next requirement is to receive publisher_confirms. I guess that
> the client-capabilities is also a pre-condition, and I have to set the
> “mandatory” parameter for the amqp_basic_publish method to 1. Is there
> anything else I have to set?

In order to enable publisher confirms,

You need to do the confirm.select (amqp_confirm_select(...) ) method on the
channel you want to enable publisher confirms on.
After which anytime you do a basic.publish, (amqp_basic_publish(...)) you
will eventually get a basic.ack back from the broker once the message has
been processed*.
* Note: processed does not mean delivered, it just means that the broker
received it and did something with it (routed to a queue, returned it,
dropped it etc).  If you want ensure that the message got routed a queue -
send the mandatory flag.  If the message isn't routed to a queue the
message will returned to the client with a basic.return, then you will be a

More information on publisher confirms:
More information on the basic publish fields:
Finally an example client that leverages rabbitmq-c and uses publisher

> Thanks in advance for any advices.
> _______________________________________________
> 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/20120117/cfc969b1/attachment.htm>

More information about the rabbitmq-discuss mailing list