NotifyPublisher need handle amqp_auto_delete

Notifypublisher and TopicConsumer must create the exchange and the
queue with the same parameters otherwise kombu raises a
'PreconditionFailed' error. But when cfg.CONF.amqp_auto_delete = True,
this is not the case. This change ensures that amqp_auto_delete
correclty set when cfg.CONF.amqp_auto_delete = True.

Closes bug: #1366597

Change-Id: I8c661deae82bcf2ae2e114621e69e0c7ae2a0a69
This commit is contained in:
Mehdi Abaakouk
2014-12-03 14:35:04 +01:00
parent 097fb235b2
commit 0359147713

View File

@@ -439,6 +439,7 @@ class NotifyPublisher(TopicPublisher):
def __init__(self, conf, channel, exchange_name, topic, **kwargs):
self.durable = kwargs.pop('durable', conf.amqp_durable_queues)
self.auto_delete = kwargs.pop('auto_delete', conf.amqp_auto_delete)
self.queue_arguments = _get_queue_arguments(conf)
super(NotifyPublisher, self).__init__(conf, channel, exchange_name,
topic, **kwargs)
@@ -452,6 +453,7 @@ class NotifyPublisher(TopicPublisher):
queue = kombu.entity.Queue(channel=channel,
exchange=self.exchange,
durable=self.durable,
auto_delete=self.auto_delete,
name=self.routing_key,
routing_key=self.routing_key,
queue_arguments=self.queue_arguments)