From 32ce45f14fc2b85bb07fbabdc82983850e009bdb Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Thu, 19 Jun 2014 22:33:06 -0700 Subject: [PATCH] Add a requeue_log_error method In order to match how there is a ack_log_error and a reject_log_error it seems appropriate to also provide a requeue_log_error method that is provided in the message class. --- kombu/message.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kombu/message.py b/kombu/message.py index 5f7ae525..0c5cb5d3 100644 --- a/kombu/message.py +++ b/kombu/message.py @@ -102,6 +102,13 @@ class Message(object): logger.critical("Couldn't reject %r, reason: %r", self.delivery_tag, exc, exc_info=True) + def requeue_log_error(self, logger, errors): + try: + self.requeue() + except errors as exc: + logger.critical("Couldn't requeue %r, reason: %r", + self.delivery_tag, exc, exc_info=True) + def reject(self, requeue=False): """Reject this message.