diff options
| author | Alan Conway <aconway@apache.org> | 2011-01-18 20:43:41 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2011-01-18 20:43:41 +0000 |
| commit | be6297381c3272178a43940ccf81986073e5ad9f (patch) | |
| tree | d71771c2cf490b27bf068ef2644f98ced45426d6 /cpp/src/qpid/cluster/UpdateClient.cpp | |
| parent | 7db454bc1eae3744c676fe9e8ddd6e999cee13f1 (diff) | |
| download | qpid-python-be6297381c3272178a43940ccf81986073e5ad9f.tar.gz | |
QPID-2982 Bug 669452 - Creating a route and using management tools can crash cluster members.
Cluster update did not include federation link and bridge
objects. Fixed update to include them.
Management linkUp and linkDown events were generated only on the
broker receiving the link. Suppressed these events in a cluster.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1060568 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/UpdateClient.cpp')
| -rw-r--r-- | cpp/src/qpid/cluster/UpdateClient.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/cpp/src/qpid/cluster/UpdateClient.cpp b/cpp/src/qpid/cluster/UpdateClient.cpp index 59db4de526..e5d20c85e6 100644 --- a/cpp/src/qpid/cluster/UpdateClient.cpp +++ b/cpp/src/qpid/cluster/UpdateClient.cpp @@ -34,6 +34,9 @@ #include "qpid/broker/Broker.h" #include "qpid/broker/Queue.h" #include "qpid/broker/QueueRegistry.h" +#include "qpid/broker/LinkRegistry.h" +#include "qpid/broker/Bridge.h" +#include "qpid/broker/Link.h" #include "qpid/broker/Message.h" #include "qpid/broker/Exchange.h" #include "qpid/broker/ExchangeRegistry.h" @@ -167,7 +170,7 @@ void UpdateClient::update() { b.getQueues().eachQueue(boost::bind(&UpdateClient::updateQueueListeners, this, _1)); ClusterConnectionProxy(session).expiryId(expiry.getId()); - + updateLinks(); updateManagementAgent(); session.close(); @@ -199,6 +202,14 @@ template <class T> std::string encode(const T& t) { t.encode(buf); return encoded; } + +template <class T> std::string encode(const T& t, bool encodeKind) { + std::string encoded; + encoded.resize(t.encodedSize()); + framing::Buffer buf(const_cast<char*>(encoded.data()), encoded.size()); + t.encode(buf, encodeKind); + return encoded; +} } // namespace @@ -583,4 +594,21 @@ void UpdateClient::updateQueueListener(std::string& q, ClusterConnectionProxy(session).addQueueListener(q, n); } +void UpdateClient::updateLinks() { + broker::LinkRegistry& links = updaterBroker.getLinks(); + links.eachLink(boost::bind(&UpdateClient::updateLink, this, _1)); + links.eachBridge(boost::bind(&UpdateClient::updateBridge, this, _1)); +} + +void UpdateClient::updateLink(const boost::shared_ptr<broker::Link>& link) { + QPID_LOG(debug, *this << " updating link " + << link->getHost() << ":" << link->getPort()); + ClusterConnectionProxy(session).config(encode(*link)); +} + +void UpdateClient::updateBridge(const boost::shared_ptr<broker::Bridge>& bridge) { + QPID_LOG(debug, *this << " updating bridge " << bridge->getName()); + ClusterConnectionProxy(session).config(encode(*bridge)); +} + }} // namespace qpid::cluster |
