From fafcc732d5164d2d88fdd8781e50c6be56a918d3 Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Mon, 28 Mar 2011 14:45:44 +0200 Subject: [PATCH] Queue.consume: Ensure consumer_tag is not None, it must be empty string for the server to generate a tag. Closes #21 --- Changelog | 6 ++++++ kombu/entity.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index aba85bf4..9399a04a 100644 --- a/Changelog +++ b/Changelog @@ -21,6 +21,12 @@ * Redis did not respect QoS settings. +* consumer_tag argument to ``Queue.consume`` can't be :const:`None` + (Issue #21). + + A None value is now automatically converted to empty string. + An empty string will make the server generate a unique tag. + * BrokerConnection now supports a ``transport_options`` argument. This can be used to pass additional arguments to transports. diff --git a/kombu/entity.py b/kombu/entity.py index 6f30a1aa..aed94f7a 100644 --- a/kombu/entity.py +++ b/kombu/entity.py @@ -415,7 +415,7 @@ class Queue(MaybeChannelBound): return _SYN(self.channel.queue_purge, queue=self.name, nowait=nowait) or 0 - def consume(self, consumer_tag=None, callback=None, no_ack=None, + def consume(self, consumer_tag='', callback=None, no_ack=None, nowait=False): """Start a queue consumer. @@ -437,7 +437,7 @@ class Queue(MaybeChannelBound): """ return self.channel.basic_consume(queue=self.name, no_ack=no_ack, - consumer_tag=consumer_tag, + consumer_tag=consumer_tag or '', callback=callback, nowait=nowait)