mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
NACK on consumer failure
(imported from commit 1cad1096dd1a969b2551822575784c338a82f433)
This commit is contained in:
@@ -96,8 +96,12 @@ class SimpleQueueClient(object):
|
||||
|
||||
def register_consumer(self, queue_name, consumer):
|
||||
def wrapped_consumer(ch, method, properties, body):
|
||||
consumer(ch, method, properties, body)
|
||||
ch.basic_ack(delivery_tag=method.delivery_tag)
|
||||
try:
|
||||
consumer(ch, method, properties, body)
|
||||
ch.basic_ack(delivery_tag=method.delivery_tag)
|
||||
except Exception, e:
|
||||
ch.basic_nack(delivery_tag=method.delivery_tag)
|
||||
raise e
|
||||
|
||||
self.consumers[queue_name].add(wrapped_consumer)
|
||||
self.ensure_queue(queue_name,
|
||||
|
||||
Reference in New Issue
Block a user