Merge "Add an example usage of RPCClient retry parameter"

This commit is contained in:
Jenkins 2014-06-19 18:53:40 +00:00 committed by Gerrit Code Review
commit b8009466ce
1 changed files with 12 additions and 0 deletions

View File

@ -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,