Merge "Add rabbit_durable_queues config option."

This commit is contained in:
Jenkins 2012-09-21 21:56:27 +00:00 committed by Gerrit Code Review
commit 8a8b01174c
3 changed files with 11 additions and 2 deletions

View File

@ -795,6 +795,12 @@ Optional. Default: ``30``
Maximum seconds to wait before reconnecting on failures when using
``rabbit`` strategy.
* ``rabbit_durable_queues``
Optional. Default: ``False``
Controls durability of exchange and queue when using ``rabbit`` strategy.
* ``qpid_notification_exchange``
Optional. Default: ``glance``

View File

@ -149,6 +149,7 @@ rabbit_password = guest
rabbit_virtual_host = /
rabbit_notification_exchange = glance
rabbit_notification_topic = glance_notifications
rabbit_durable_queues = False
# Configuration options if sending notifications via Qpid (these are
# the defaults)

View File

@ -38,7 +38,8 @@ rabbit_opts = [
default='glance_notifications'),
cfg.StrOpt('rabbit_max_retries', default=0),
cfg.StrOpt('rabbit_retry_backoff', default=2),
cfg.StrOpt('rabbit_retry_max_backoff', default=30)
cfg.StrOpt('rabbit_retry_max_backoff', default=30),
cfg.StrOpt('rabbit_durable_queues', default=False),
]
CONF = cfg.CONF
@ -103,6 +104,7 @@ class RabbitStrategy(strategy.Strategy):
self.exchange = kombu.entity.Exchange(
channel=self.channel,
type="topic",
durable=CONF.rabbit_durable_queues,
name=CONF.rabbit_notification_exchange)
# NOTE(jerdfelt): Normally the consumer would create the queues,
@ -113,7 +115,7 @@ class RabbitStrategy(strategy.Strategy):
queue = kombu.entity.Queue(
channel=self.channel,
exchange=self.exchange,
durable=True,
durable=CONF.rabbit_durable_queues,
name=routing_key,
routing_key=routing_key)
queue.declare()