summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavanum Srinivas <davanum@gmail.com>2015-05-27 09:32:15 -0400
committerDavanum Srinivas (dims) <davanum@gmail.com>2015-06-09 11:53:20 +0000
commitb5e1583e9358bc765c5978b30d4bccf225f50842 (patch)
treeafe7c16271d51d1190b542645c3b26199938ffa8
parent562c41bb78f578ff9c27633c04ac6dd914c55f5a (diff)
downloadoslo-messaging-b5e1583e9358bc765c5978b30d4bccf225f50842.tar.gz
Adding Publisher Acknowledgements/confirms
During the vancouver summit, Michael Klishin from pivotal proposed we should use publisher confirms as the default setting to reduce messages being dropped on the floor. https://www.rabbitmq.com/confirms.html http://www.rabbitmq.com/blog/2011/02/10/introducing-publisher-confirms/ This setting is a lightweight way of keeping track of which messages have been processed by the broker and which would need re-publishing in case of broker shutdown or network failure. Change-Id: I25bc955df130dad4725f5281211d37fd73e7ea63 (cherry picked from commit cd63a7023519b82a46b3f29f2691ff32c5085c9f)
-rw-r--r--oslo_messaging/_drivers/impl_rabbit.py3
-rw-r--r--oslo_messaging/tests/drivers/test_impl_rabbit.py3
2 files changed, 4 insertions, 2 deletions
diff --git a/oslo_messaging/_drivers/impl_rabbit.py b/oslo_messaging/_drivers/impl_rabbit.py
index 437f2de..8a93855 100644
--- a/oslo_messaging/_drivers/impl_rabbit.py
+++ b/oslo_messaging/_drivers/impl_rabbit.py
@@ -661,7 +661,8 @@ class Connection(object):
self._url, ssl=self._fetch_ssl_params(),
login_method=self._login_method,
failover_strategy="shuffle",
- heartbeat=self.driver_conf.heartbeat_timeout_threshold)
+ heartbeat=self.driver_conf.heartbeat_timeout_threshold,
+ transport_options={'confirm_publish': True})
LOG.info(_LI('Connecting to AMQP server on %(hostname)s:%(port)d'),
self.connection.info())
diff --git a/oslo_messaging/tests/drivers/test_impl_rabbit.py b/oslo_messaging/tests/drivers/test_impl_rabbit.py
index 3d81c70..38bca87 100644
--- a/oslo_messaging/tests/drivers/test_impl_rabbit.py
+++ b/oslo_messaging/tests/drivers/test_impl_rabbit.py
@@ -169,7 +169,8 @@ class TestRabbitDriverLoadSSL(test_utils.BaseTestCase):
transport._driver._get_connection()
connection_klass.assert_called_once_with(
- 'memory:///', ssl=self.expected, login_method='AMQPLAIN',
+ 'memory:///', transport_options={'confirm_publish': True},
+ ssl=self.expected, login_method='AMQPLAIN',
heartbeat=0, failover_strategy="shuffle")