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.
This commit is contained in:
Joshua Harlow 2014-06-19 22:33:06 -07:00
parent d3a36c6750
commit 32ce45f14f
1 changed files with 7 additions and 0 deletions

View File

@ -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.