[rabbitmq-discuss] publisher confirmations

Gavin M. Roy gmr at myyearbook.com
Tue Nov 29 14:58:32 GMT 2011


I am not using it in production yet, but we do have all of those features in github Master, 0.9.6p0. I am in process of writing tests and cleaning up 0.9.6 for release.

Test it and see if it works for you. I'd not be concerned about production use if you do not run into any issues.

Gavin 


On Tuesday, November 29, 2011 at 8:55 AM, Roey Berman wrote:

> I've created a pull request which fixes the demo: https://github.com/pika/pika/pull/109
> 
> Note:
> The stable pika release (0.9.5) doesn't add the Basic.Nack and Confirm.SelectOk callbacks when you call channel.confirm_delivery()
> you'll explicitly have to call channel.add_callback(on_delivered, ['Basic.Nack', 'Confirm.SelectOk'])
> 
> 
> Would you recommend using the git master version of pika or 0.9.5 for a production environment? 
> On Mon, Nov 28, 2011 at 1:53 PM, Roey Berman <roey.berman at gmail.com (mailto:roey.berman at gmail.com)> wrote:
> > Thanks again for the quick response.
> > 
> > I also read http://www.rabbitmq.com/extensions.html#publishing before posting this question. 
> > 
> > But again my problem is with simulating server nacks so i can create a test case for my code.
> > 
> > Do you have any idea how I can do that?
> > 
> > On Mon, Nov 28, 2011 at 1:26 PM, Marek Majkowski <majek04 at gmail.com (mailto:majek04 at gmail.com)> wrote:
> > > On Mon, Nov 28, 2011 at 11:11, Roey Berman <roey.berman at gmail.com (mailto:roey.berman at gmail.com)> wrote:
> > > > Oh one fix:
> > > > self.chan.basic_publish(message, **kwargs) -> self.chan.basic_publish(body =
> > > > message, **kwargs)
> > > >
> > > > On Mon, Nov 28, 2011 at 1:08 PM, Roey Berman <roey.berman at gmail.com (mailto:roey.berman at gmail.com)> wrote:
> > > >>
> > > >> Thanks for the quick reply.
> > > >> At first I used the code from the example you referred me to but it
> > > >> doesn't handle the "multiple" flag and NAcks from the server.
> > > >> I know my code handles the "multiple" flag, but don't know about NAcks.
> > > >> I don't really know how to test for nacks since I've never gotten them
> > > >> from rabbitmq server.
> > > 
> > > http://www.rabbitmq.com/extensions.html#publishing
> > > 
> > > "In exceptional cases when the broker is unable to handle messages
> > > successfully, instead of a basic.ack, the broker will send a
> > > basic.nack. In this context, fields of the basic.nack have the same
> > > meaning as the corresponding ones in basic.ack and the requeue field
> > > should be ignored. By nack'ing one or more messages, the broker
> > > indicates that it was unable to process the messages and refuses
> > > responsibility for them; at that point, the client may choose to
> > > re-publish the messages.
> > > 
> > > After a channel is put into confirm mode, all subsequently published
> > > messages will be confirmed or nack'd once. No guarantees are made as
> > > to how soon a message is confirmed. No message will be both confirmed
> > > and nack'd."
> > > 
> > > That's all I know.
> > > 
> > > 
> > > >> Once I know my code handles all responses correctly I will create a pull
> > > >> request for the pika example code.
> > > 
> > > Good!
> > > 
> > > Marek
> > > 
> > > 
> > > >> On Mon, Nov 28, 2011 at 1:01 PM, Marek Majkowski <majek04 at gmail.com (mailto:majek04 at gmail.com)>
> > > >> wrote:
> > > >>>
> > > >>> Hi,
> > > >>>
> > > >>> I'm not sure if it works - but the pika example showing
> > > >>> publisher confirms usage looks rather similar:
> > > >>>
> > > >>>
> > > >>> https://github.com/pika/pika/blob/120fdea5913e7ed80536ff55634ab0f8f4554e79/examples/demo_send_confirmed.py
> > > >>>
> > > >>> Cheer,
> > > >>>  Marek
> > > >>>
> > > >>> On Sun, Nov 27, 2011 at 15:20, bergundy <roey.berman at gmail.com (mailto:roey.berman at gmail.com)> wrote:
> > > >>> > Hi everyone,
> > > >>> >
> > > >>> > I couldn't find code for implementing publisher confirmations.
> > > >>> >
> > > >>> > I wrote this piece of code using pika 0.9.5 (python client).
> > > >>> > Would like to get feedback on this, I hope I got it right ...
> > > >>> >
> > > >>> > ---
> > > >>> > class ConfirmingProducer(object):
> > > >>> >    def __init__(self, channel):
> > > >>> >        self.delivery_tag = 1
> > > >>> >        self.acked        = 0
> > > >>> >        self._callbacks   = {}
> > > >>> >        self.chan = channel
> > > >>> >        self.chan.confirm_delivery(self.on_delivered)
> > > >>> >
> > > >>> >    def publish(self, message, callback, **kwargs):
> > > >>> >        self._callbacks[self.delivery_tag] = callback
> > > >>> >        self.delivery_tag += 1
> > > >>> >        self.chan.basic_publish(message, **kwargs)
> > > >>> >
> > > >>> >    def on_delivered(self, frame):
> > > >>> >        success = isinstance(frame.method, pika.spec.Basic.Ack)
> > > >>> >
> > > >>> >        if frame.method.multiple:
> > > >>> >            for dtag in range(self.acked+1, frame.method.delivery_tag
> > > >>> > +1):
> > > >>> >                self._callbacks.pop(dtag)(success)
> > > >>> >            self.acked = frame.method.delivery_tag
> > > >>> >        else:
> > > >>> >            self._callbacks.pop(frame.method.delivery_tag)(success)
> > > >>> >            self.acked += 1
> > > >>> > _______________________________________________
> > > >>> > rabbitmq-discuss mailing list
> > > >>> > rabbitmq-discuss at lists.rabbitmq.com (mailto:rabbitmq-discuss at lists.rabbitmq.com)
> > > >>> > https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
> > > >>> >
> > > >>
> > > >
> > > >
> > 
> 
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com (mailto: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/20111129/d39ed50d/attachment.htm>


More information about the rabbitmq-discuss mailing list