summaryrefslogtreecommitdiff
path: root/oslo
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2014-06-13 15:28:18 +0100
committerMark McLoughlin <markmc@redhat.com>2014-06-13 15:42:00 +0100
commit2cdf9ec5ffae7fac9ee6af9808b4cf2d00fcc11d (patch)
treee1747bea89a2047176813f929fa80b06f6ccecf1 /oslo
parent948c05417c7a44f85d3e77bae35e02f5c31834d7 (diff)
downloadoslo-messaging-2cdf9ec5ffae7fac9ee6af9808b4cf2d00fcc11d.tar.gz
Add an example usage of RPCClient retry parameter
Change-Id: Ib88870b312721deff0d9b6db2ba2e3cb99da6038
Diffstat (limited to 'oslo')
-rw-r--r--oslo/messaging/rpc/client.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/oslo/messaging/rpc/client.py b/oslo/messaging/rpc/client.py
index 8abb156..a140ffe 100644
--- a/oslo/messaging/rpc/client.py
+++ b/oslo/messaging/rpc/client.py
@@ -246,6 +246,18 @@ class RPCClient(object):
but this is probably only useful in limited circumstances as a wrapper
class will usually help to make the code much more obvious.
+
+ By default, cast() and call() will block until the message is successfully
+ sent. However, the retry parameter can be used to have message sending
+ fail with a MessageDeliveryFailure after the given number of retries. For
+ example::
+
+ client = messaging.RPCClient(transport, target, retry=None)
+ client.call(ctxt, 'sync')
+ try:
+ client.prepare(retry=0).cast(ctxt, 'ping')
+ except messaging.MessageDeliveryFailure:
+ LOG.error("Failed to send ping message")
"""
def __init__(self, transport, target,