diff options
author | Rafael H. Schloming <rhs@apache.org> | 2010-04-01 21:36:56 +0000 |
---|---|---|
committer | Rafael H. Schloming <rhs@apache.org> | 2010-04-01 21:36:56 +0000 |
commit | de5ca86b1cad3f879ffea1a0af0a58c7a8560d02 (patch) | |
tree | e95d8e36cfed53f9dca8c07abbe736fa63f016b2 /python/qpid/messaging/util.py | |
parent | e63d139b7f275d2271d4a5f15b9894836ab1e371 (diff) | |
download | qpid-python-de5ca86b1cad3f879ffea1a0af0a58c7a8560d02.tar.gz |
added option to disable reconnect logging; fixed reconnect test to not loop forever if no broker is running; backups -> reconnect_hosts
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@930105 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/messaging/util.py')
-rw-r--r-- | python/qpid/messaging/util.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/python/qpid/messaging/util.py b/python/qpid/messaging/util.py index 12c02475f0..30b54f3ad4 100644 --- a/python/qpid/messaging/util.py +++ b/python/qpid/messaging/util.py @@ -26,31 +26,31 @@ from threading import Thread log = getLogger("qpid.messaging.util") -def auto_update_backups(conn): - ssn = conn.session("auto-update-backups") +def auto_fetch_reconnect_hosts(conn): + ssn = conn.session("auto-fetch-reconnect-hosts") rcv = ssn.receiver("amq.failover") rcv.capacity = 10 def main(): while True: msg = rcv.fetch() - update_backups(conn, msg) + set_reconnect_hosts(conn, msg) ssn.acknowledge(msg, sync=False) - thread = Thread(name="auto-update-backups", target=main) + thread = Thread(name="auto-fetch-reconnect-hosts", target=main) thread.setDaemon(True) thread.start() -def update_backups(conn, msg): - backups = [] +def set_reconnect_hosts(conn, msg): + reconnect_hosts = [] urls = msg.properties["amq.failover"] for u in urls: if u.startswith("amqp:tcp:"): parts = u.split(":") host, port = parts[2:4] - backups.append((host, port)) - conn.backups = backups - log.warn("updated backups for conn %s: %s", conn, backups) + reconnect_hosts.append((host, port)) + conn.reconnect_hosts = reconnect_hosts + log.warn("set reconnect_hosts for conn %s: %s", conn, reconnect_hosts) -__all__ = ["auto_update_backups", "update_backups"] +__all__ = ["auto_fetch_reconnect_hosts", "set_reconnect_hosts"] |