summaryrefslogtreecommitdiffstats
path: root/openstack/common/rpc/impl_qpid.py
diff options
context:
space:
mode:
authorBrent Eagles <beagles@redhat.com>2013-01-28 13:34:55 -0330
committerBrent Eagles <beagles@redhat.com>2013-01-28 17:45:08 -0330
commit30a50c8a6c534f01d518eb3ce4cf0d35877d9a7f (patch)
treeadb7220ed3ecacf1fc5cab2e94c6643f2ea3e185 /openstack/common/rpc/impl_qpid.py
parentb5288ab022d3733abae25971ca8afb56f1a7011b (diff)
downloadoslo-30a50c8a6c534f01d518eb3ce4cf0d35877d9a7f.tar.gz
oslo-30a50c8a6c534f01d518eb3ce4cf0d35877d9a7f.tar.xz
oslo-30a50c8a6c534f01d518eb3ce4cf0d35877d9a7f.zip
Add TTL to AMQP messages
This patch sets a TTL derived from the timeout parameter used when invoking the RPC. Needed for: * Bug 1053614 Change-Id: Idaf9a2a972feac3f95f170c52632033b027b4414
Diffstat (limited to 'openstack/common/rpc/impl_qpid.py')
-rw-r--r--openstack/common/rpc/impl_qpid.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/openstack/common/rpc/impl_qpid.py b/openstack/common/rpc/impl_qpid.py
index b6691b4..9d3a3a7 100644
--- a/openstack/common/rpc/impl_qpid.py
+++ b/openstack/common/rpc/impl_qpid.py
@@ -486,9 +486,20 @@ class Connection(object):
"""Send a 'direct' message"""
self.publisher_send(DirectPublisher, msg_id, msg)
- def topic_send(self, topic, msg):
+ def topic_send(self, topic, msg, timeout=None):
"""Send a 'topic' message"""
- self.publisher_send(TopicPublisher, topic, msg)
+ #
+ # We want to create a message with attributes, e.g. a TTL. We
+ # don't really need to keep 'msg' in its JSON format any longer
+ # so let's create an actual qpid message here and get some
+ # value-add on the go.
+ #
+ # WARNING: Request timeout happens to be in the same units as
+ # qpid's TTL (seconds). If this changes in the future, then this
+ # will need to be altered accordingly.
+ #
+ qpid_message = qpid_messaging.Message(content=msg, ttl=timeout)
+ self.publisher_send(TopicPublisher, topic, qpid_message)
def fanout_send(self, topic, msg):
"""Send a 'fanout' message"""