summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Robie <jonathan@apache.org>2011-01-10 13:48:35 +0000
committerJonathan Robie <jonathan@apache.org>2011-01-10 13:48:35 +0000
commitde0bef9f28c6e6b2238405086e3e0177ed36901a (patch)
treed4a69b1fe7a37496745250c191c2c0e4122290d9
parent952a5c6c479aaa360f86800cad6d4a34516d95fa (diff)
downloadqpid-python-de0bef9f28c6e6b2238405086e3e0177ed36901a.tar.gz
Prints connection error information.
Previously, connection errors were silently ignored. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1057195 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/extras/qmf/src/py/qmf/console.py6
-rwxr-xr-xqpid/tools/src/py/qpid-printevents4
2 files changed, 10 insertions, 0 deletions
diff --git a/qpid/extras/qmf/src/py/qmf/console.py b/qpid/extras/qmf/src/py/qmf/console.py
index 45a8a61fa0..430ca60b98 100644
--- a/qpid/extras/qmf/src/py/qmf/console.py
+++ b/qpid/extras/qmf/src/py/qmf/console.py
@@ -53,6 +53,10 @@ class Console:
""" Invoked when a connection is established to a broker """
pass
+ def brokerConnectionFailed(self, broker):
+ """ Invoked when a connection to a broker fails """
+ pass
+
def brokerDisconnected(self, broker):
""" Invoked when the connection to a broker is lost """
pass
@@ -2510,6 +2514,8 @@ class Broker(Thread):
except Exception, e:
self.error = "Exception during connection setup: %s - %s" % (e.__class__.__name__, e)
self.conn_exc = e
+ if self.session.console:
+ self.session.console.brokerConnectionFailed(self)
return False # connection failed
def _updateAgent(self, obj):
diff --git a/qpid/tools/src/py/qpid-printevents b/qpid/tools/src/py/qpid-printevents
index 260d0df79d..2be2f0be8b 100755
--- a/qpid/tools/src/py/qpid-printevents
+++ b/qpid/tools/src/py/qpid-printevents
@@ -37,6 +37,10 @@ class EventConsole(Console):
print strftime("%c", gmtime(time())), "NOTIC qpid-printevents:brokerConnected broker=%s" % broker.getUrl()
sys.stdout.flush()
+ def brokerConnectionFailed(self, broker):
+ print strftime("%c", gmtime(time())), "NOTIC qpid-printevents:brokerConnectionFailed broker=%s %s" % (broker.getUrl(), str(broker.conn_exc))
+ sys.stdout.flush()
+
def brokerDisconnected(self, broker):
print strftime("%c", gmtime(time())), "NOTIC qpid-printevents:brokerDisconnected broker=%s" % broker.getUrl()
sys.stdout.flush()