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

TZHA sophiewenxizhang at googlemail.com
Thu Jan 19 12:04:22 GMT 2012


Thanks for the reply.

I am now in the position to get the cancellation notification
following your advice.

On 17 Jan., 16:52, Alan Antonuk <alan.anto... at gmail.com> wrote:
> Responses inlined
>
> On Mon, Jan 16, 2012 at 5:02 AM, TZHA <sophiewenxizh... 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:http://www.rabbitmq.com/extensions.html
>
> 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
> basic.ack.
>
> More information on publisher confirms:http://www.rabbitmq.com/amqp-0-9-1-reference.html#class.confirm
> More information on the basic publish fields:http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.publish
> Finally an example client that leverages rabbitmq-c and uses publisher
> confirms:https://github.com/alanxz/SimpleAmqpClient/blob/master/src/Channel.cp...
>
>
>
>
>
>
>
> > Thanks in advance for any advices.
> > _______________________________________________
> > rabbitmq-discuss mailing list
> > rabbitmq-disc... at lists.rabbitmq.com
> >https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-disc... at lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


More information about the rabbitmq-discuss mailing list