diff options
| author | Jonathan Robie <jonathan@apache.org> | 2011-01-13 20:54:03 +0000 |
|---|---|---|
| committer | Jonathan Robie <jonathan@apache.org> | 2011-01-13 20:54:03 +0000 |
| commit | 38723ee5b89df32d8d36dee1cb8c2826e5bfe8e9 (patch) | |
| tree | 260e9e22f30290891c57a855268fc0111f39edec /cpp/src/qpid/broker/DirectExchange.cpp | |
| parent | 9c16fa21baa3b48772ee1f46e7a14647a032248d (diff) | |
| download | qpid-python-38723ee5b89df32d8d36dee1cb8c2826e5bfe8e9.tar.gz | |
Fixes QPID-2499: Stale federation routes remain after route deletion.
Federated binds and unbinds need to know which federation origins
are associated with the bindings for each queue. When origins are
added or deleted, the corresponding bindings need to be
propagated.
fedBindings[queueName] contains the origins associated with the
given queue.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1058747 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/DirectExchange.cpp')
| -rw-r--r-- | cpp/src/qpid/broker/DirectExchange.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cpp/src/qpid/broker/DirectExchange.cpp b/cpp/src/qpid/broker/DirectExchange.cpp index fc52ab3711..5b8104c77c 100644 --- a/cpp/src/qpid/broker/DirectExchange.cpp +++ b/cpp/src/qpid/broker/DirectExchange.cpp @@ -76,13 +76,13 @@ bool DirectExchange::bind(Queue::shared_ptr queue, const string& routingKey, con if (bk.queues.add_unless(b, MatchQueue(queue))) { b->startManagement(); - propagate = bk.fedBinding.addOrigin(fedOrigin); + propagate = bk.fedBinding.addOrigin(queue->getName(), fedOrigin); if (mgmtExchange != 0) { mgmtExchange->inc_bindingCount(); } } else { // queue already present - still need to track fedOrigin - bk.fedBinding.addOrigin(fedOrigin); + bk.fedBinding.addOrigin(queue->getName(), fedOrigin); return false; } } else if (fedOp == fedOpUnbind) { @@ -90,11 +90,12 @@ bool DirectExchange::bind(Queue::shared_ptr queue, const string& routingKey, con BoundKey& bk = bindings[routingKey]; QPID_LOG(debug, "Bind - fedOpUnbind key [" << routingKey << "] queue " << queue->getName() - << " (origin=" << fedOrigin << ")"); + << " (origin=" << fedOrigin << ")" << " (count=" << bk.fedBinding.count() << ")"); - propagate = bk.fedBinding.delOrigin(fedOrigin); - if (bk.fedBinding.count() == 0) + propagate = bk.fedBinding.delOrigin(queue->getName(), fedOrigin); + if (bk.fedBinding.countFedBindings(queue->getName()) == 0) unbind(queue, routingKey, 0); + } else if (fedOp == fedOpReorigin) { /** gather up all the keys that need rebinding in a local vector * while holding the lock. Then propagate once the lock is @@ -142,6 +143,7 @@ bool DirectExchange::unbind(Queue::shared_ptr queue, const string& routingKey, c } } + // If I delete my local binding, propagate this unbind to any upstream brokers if (propagate) propagateFedOp(routingKey, string(), fedOpUnbind, string()); return true; |
