summaryrefslogtreecommitdiff
path: root/qpid/python/examples/api/server
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2010-01-29 21:41:46 +0000
committerRafael H. Schloming <rhs@apache.org>2010-01-29 21:41:46 +0000
commite651a3846f8d610201e6e81f59e225bbfd8b6e7b (patch)
treeec920d15881dd428451f695cd6d024755c346f28 /qpid/python/examples/api/server
parente0410a0172b428b6cfa5baaf9b95f9107a9f7571 (diff)
downloadqpid-python-e651a3846f8d610201e6e81f59e225bbfd8b6e7b.tar.gz
added reconnect_delay, reconnect_limit, and backups option to Connection
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@904634 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python/examples/api/server')
-rwxr-xr-xqpid/python/examples/api/server16
1 files changed, 13 insertions, 3 deletions
diff --git a/qpid/python/examples/api/server b/qpid/python/examples/api/server
index adb2dcf792..a9cd8579e3 100755
--- a/qpid/python/examples/api/server
+++ b/qpid/python/examples/api/server
@@ -28,7 +28,14 @@ parser = optparse.OptionParser(usage="usage: %prog [options] ADDRESS ...",
description="handle requests from the supplied address.")
parser.add_option("-b", "--broker", default="localhost",
help="connect to specified BROKER (default %default)")
-parser.add_option("-v", dest="verbose", action="store_true", help="enable logging")
+parser.add_option("-r", "--reconnect", action="store_true",
+ help="enable auto reconnect")
+parser.add_option("-d", "--reconnect-delay", type=float, default=3,
+ help="delay between reconnect attempts")
+parser.add_option("-l", "--reconnect-limit", type=int,
+ help="maximum number of reconnect attempts")
+parser.add_option("-v", dest="verbose", action="store_true",
+ help="enable logging")
opts, args = parser.parse_args()
@@ -45,8 +52,11 @@ else:
# XXX: should make URL default the port for us
conn = Connection.open(url.host, url.port or AMQP_PORT,
- username=url.user, password=url.password)
-conn.reconnect = True
+ username=url.user,
+ password=url.password,
+ reconnect=opts.reconnect,
+ reconnect_delay=opts.reconnect_delay,
+ reconnect_limit=opts.reconnect_limit)
ssn = conn.session()
rcv = ssn.receiver(addr)