diff options
author | Kim van der Riet <kpvdr@apache.org> | 2009-10-29 20:41:22 +0000 |
---|---|---|
committer | Kim van der Riet <kpvdr@apache.org> | 2009-10-29 20:41:22 +0000 |
commit | 1439f10f1f98edc05a12c64b44005f9c2fbc124e (patch) | |
tree | d9d3de114e5df5d5aa373a6eed342c168b0c2e70 /cpp/src/qpid/broker/Queue.cpp | |
parent | 93e2dbae88c8960b82f46e499b5d91c20547702f (diff) | |
download | qpid-python-1439f10f1f98edc05a12c64b44005f9c2fbc124e.tar.gz |
Fixed problem of queue alternate-exchange property not being persisted on persistent queues, and on recovery this property is lost. No tests exist as yet for this.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@831082 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/Queue.cpp')
-rw-r--r-- | cpp/src/qpid/broker/Queue.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp index b4160edbd6..6496840b0b 100644 --- a/cpp/src/qpid/broker/Queue.cpp +++ b/cpp/src/qpid/broker/Queue.cpp @@ -917,6 +917,7 @@ void Queue::setPersistenceId(uint64_t _persistenceId) const void Queue::encode(Buffer& buffer) const { buffer.putShortString(name); + buffer.putShortString(alternateExchange.get() ? alternateExchange->getName() : std::string("")); buffer.put(settings); if (policy.get()) { buffer.put(*policy); @@ -925,7 +926,9 @@ void Queue::encode(Buffer& buffer) const uint32_t Queue::encodedSize() const { - return name.size() + 1/*short string size octet*/ + settings.encodedSize() + return name.size() + 1/*short string size octet*/ + + (alternateExchange.get() ? alternateExchange->getName().size() : 0) + 1 /* short string */ + + settings.encodedSize() + (policy.get() ? (*policy).encodedSize() : 0); } @@ -933,7 +936,10 @@ Queue::shared_ptr Queue::decode ( QueueRegistry& queues, Buffer& buffer, bool re { string name; buffer.getShortString(name); + string altExch; + buffer.getShortString(altExch); std::pair<Queue::shared_ptr, bool> result = queues.declare(name, true); + result.first->alternateExchangeName.assign(altExch); buffer.get(result.first->settings); result.first->configure(result.first->settings, recovering ); if (result.first->policy.get() && buffer.available() >= result.first->policy->encodedSize()) { @@ -1048,8 +1054,17 @@ void Queue::setQueueEventManager(QueueEvents& mgr) eventMgr = &mgr; } -void Queue::recoveryComplete() +void Queue::recoveryComplete(ExchangeRegistry& exchanges) { + // set the alternate exchange + if (!alternateExchangeName.empty()) { + try { + Exchange::shared_ptr ae = exchanges.get(alternateExchangeName); + setAlternateExchange(ae); + } catch (const NotFoundException&) { + QPID_LOG(warning, "Could not set alternate exchange \"" << alternateExchangeName << "\" on queue \"" << name << "\": exchange does not exist."); + } + } //process any pending dequeues for_each(pendingDequeues.begin(), pendingDequeues.end(), boost::bind(&Queue::dequeue, this, (TransactionContext*) 0, _1)); pendingDequeues.clear(); |