[rabbitmq-discuss] Is Pika's add_on_return_callback supposed to be single use?

Matt Pietrek mpietrek at skytap.com
Fri Aug 17 21:24:25 BST 2012

(Would publish to a Pika mailing list if there was one, but since there
doesn't seem to be...)

After registering a returned message handler in Pika, I noticed that it
only gets called once. Digging into the code, I see this:

    def add_on_return_callback(self, callback):
        Pass a callback function that will be called when basic_publish as
        a message that has been rejected and returned by the server. The
        callback handler should receive a method, header and body frame. The
        base signature for the callback should be the same as the method
        signature one creates for a basic_consume callback.
       * self.callbacks.add(self.channel_number, '_on_basic_return',

The CallbackManager.add() method is defined like this:

    def add(self, prefix, key, callback,* one_shot=True*, only_caller=None):

Since add_on_return_callback doesn't specify a value for the one_shot
keyword arg, it defaults to True, which explains exactly the behavior I'm

Is this the correct behavior or an oversight?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120817/f229f918/attachment.htm>

More information about the rabbitmq-discuss mailing list