From 2cdf9ec5ffae7fac9ee6af9808b4cf2d00fcc11d Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc@redhat.com>
Date: Fri, 13 Jun 2014 15:28:18 +0100
Subject: [PATCH] Add an example usage of RPCClient retry parameter

Change-Id: Ib88870b312721deff0d9b6db2ba2e3cb99da6038
---
 oslo/messaging/rpc/client.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/oslo/messaging/rpc/client.py b/oslo/messaging/rpc/client.py
index 8abb156c4..a140ffe2d 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,