From ded89418a216bfd28a602eb5713d7665c08e5be1 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Fri, 1 Jul 2016 13:15:35 -0400 Subject: [PATCH] [AMQP 1.0] Add configuration parameters for send message deadline This patch add driver configuration option parameters for oslo_messaging_amqp reply, send and notification timeout. These timeouts are used when the caller does not provide a timeout expiry. Change-Id: I398a4686abf3df6e5c802d94d6bda7ba9995833d Depends-On: I6b60b6944a4c44da9b2e41ab2a83ab59f15e396e Closes-Bug: #1596641 --- oslo_messaging/_drivers/amqp1_driver/opts.py | 20 +++++++++++++++++++- oslo_messaging/_drivers/impl_amqp1.py | 9 +++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/oslo_messaging/_drivers/amqp1_driver/opts.py b/oslo_messaging/_drivers/amqp1_driver/opts.py index 06ed3b278..cfc23002d 100644 --- a/oslo_messaging/_drivers/amqp1_driver/opts.py +++ b/oslo_messaging/_drivers/amqp1_driver/opts.py @@ -103,7 +103,7 @@ amqp1_opts = [ help='Maximum limit for connection_retry_interval' ' + connection_retry_backoff'), - # Message send retry options + # Message send retry and timeout options cfg.IntOpt('max_send_retries', default=0, @@ -118,6 +118,24 @@ amqp1_opts = [ help='Time to pause between re-connecting an AMQP 1.0 link that' ' failed due to a recoverable error.'), + cfg.IntOpt('default_reply_timeout', + default=30, + min=5, + help='The deadline for an rpc reply message delivery.' + ' Only used when caller does not provide a timeout expiry.'), + + cfg.IntOpt('default_send_timeout', + default=60, + min=5, + help='The deadline for an rpc cast or call message delivery.' + ' Only used when caller does not provide a timeout expiry.'), + + cfg.IntOpt('default_notify_timeout', + default=60, + min=5, + help='The deadline for a sent notification message delivery.' + ' Only used when caller does not provide a timeout expiry.'), + # Addressing: cfg.StrOpt('addressing_mode', diff --git a/oslo_messaging/_drivers/impl_amqp1.py b/oslo_messaging/_drivers/impl_amqp1.py index 02cbe280d..aeb3b1b01 100644 --- a/oslo_messaging/_drivers/impl_amqp1.py +++ b/oslo_messaging/_drivers/impl_amqp1.py @@ -221,10 +221,11 @@ class ProtonDriver(base.BaseDriver): self._pid = None self._lock = threading.Lock() - # TODO(kgiusti): make configurable: - self._default_reply_timeout = 30 - self._default_send_timeout = 60 - self._default_notify_timeout = 60 + # timeout for message acknowledgement + opt_name = conf.oslo_messaging_amqp + self._default_reply_timeout = opt_name.default_reply_timeout + self._default_send_timeout = opt_name.default_send_timeout + self._default_notify_timeout = opt_name.default_notify_timeout def _ensure_connect_called(func): """Causes a new controller to be created when the messaging service is