From 984211484d83163169f9949240573af8a4d3d332 Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Wed, 7 Nov 2012 12:55:46 -0400 Subject: [PATCH] ugh, messed up the merge --- worker/worker.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/worker/worker.py b/worker/worker.py index 6bf156a..9a3165f 100644 --- a/worker/worker.py +++ b/worker/worker.py @@ -39,9 +39,10 @@ LOG.addHandler(handler) class NovaConsumer(kombu.mixins.ConsumerMixin): - def __init__(self, name, connection, deployment): + def __init__(self, name, connection, deployment, durable): self.connection = connection self.deployment = deployment + self.durable = durable self.name = name self.last_time = None self.pmi = None @@ -49,15 +50,15 @@ class NovaConsumer(kombu.mixins.ConsumerMixin): self.total_processed = 0 def get_consumers(self, Consumer, channel): - durable = self.deployment_config.get('durable_queue', True) nova_exchange = kombu.entity.Exchange("nova", type="topic", - exclusive=False, durable=durable, auto_delete=False) + exclusive=False, durable=self.durable, + auto_delete=False) nova_queues = [ - kombu.Queue("monitor.info", nova_exchange, durable=durable, + kombu.Queue("monitor.info", nova_exchange, durable=self.durable, auto_delete=False, exclusive=False, routing_key='monitor.info'), - kombu.Queue("monitor.error", nova_exchange, durable=durable, + kombu.Queue("monitor.error", nova_exchange, durable=self.durable, auto_delete=False, exclusive=False, routing_key='monitor.error'), ] @@ -122,6 +123,7 @@ def run(deployment_config): user_id = deployment_config.get('rabbit_userid', 'rabbit') password = deployment_config.get('rabbit_password', 'rabbit') virtual_host = deployment_config.get('rabbit_virtual_host', '/') + durable = deployment_config.get('durable_queue', True) deployment, new = models.get_or_create_deployment(name) @@ -139,7 +141,7 @@ def run(deployment_config): LOG.debug("Processing on '%s'" % name) with kombu.connection.BrokerConnection(**params) as conn: try: - consumer = NovaConsumer(name, conn, deployment) + consumer = NovaConsumer(name, conn, deployment, durable) consumer.run() except Exception as e: LOG.exception("name=%s, exception=%s. Reconnecting in 5s" %