summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/qpid/client/Dispatcher.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-10-10 04:49:48 +0000
committerAlan Conway <aconway@apache.org>2008-10-10 04:49:48 +0000
commit519114ee3ae3c09f751f936768b5b7600398d4e0 (patch)
treee909211f448d553aa08530cbd8a25e7268e4adcf /qpid/cpp/src/qpid/client/Dispatcher.cpp
parentacfdb12db461549d7886ab5049e6da7ed8551053 (diff)
downloadqpid-python-519114ee3ae3c09f751f936768b5b7600398d4e0.tar.gz
QPID-1340 froM Mick Goulish: preliminary client-side failover support.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@703319 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/qpid/client/Dispatcher.cpp')
-rw-r--r--qpid/cpp/src/qpid/client/Dispatcher.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/client/Dispatcher.cpp b/qpid/cpp/src/qpid/client/Dispatcher.cpp
index 5028d68405..08905bc96c 100644
--- a/qpid/cpp/src/qpid/client/Dispatcher.cpp
+++ b/qpid/cpp/src/qpid/client/Dispatcher.cpp
@@ -49,7 +49,10 @@ void Subscriber::received(Message& msg)
}
Dispatcher::Dispatcher(const Session& s, const std::string& q)
- : session(s), running(false), autoStop(true)
+ : session(s),
+ running(false),
+ autoStop(true),
+ failoverHandler(0)
{
queue = q.empty() ?
session.getExecution().getDemux().getDefault() :
@@ -91,9 +94,20 @@ void Dispatcher::run()
}
session.sync(); // Make sure all our acks are received before returning.
}
- catch (const ClosedException&) {} //ignore it and return
+ catch (const ClosedException& e)
+ {
+ QPID_LOG(debug, "Ignored exception in client dispatch thread: " << e.what());
+ } //ignore it and return
catch (const std::exception& e) {
QPID_LOG(error, "Exception in client dispatch thread: " << e.what());
+ if ( failoverHandler )
+ {
+ failoverHandler();
+ }
+ else
+ {
+ QPID_LOG(info, "No dispatcher failover handler registered.");
+ }
}
}