diff options
author | Alan Conway <aconway@apache.org> | 2007-02-06 21:38:30 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2007-02-06 21:38:30 +0000 |
commit | 877e7ae368d4320bd60ba5750be207a5cac13f43 (patch) | |
tree | 9f0777c5e6069b537e13d1c1f88cc08560f47de3 /cpp/lib/broker/BrokerAdapter.cpp | |
parent | a0c19714ccb547c401e598189a36573ac750e809 (diff) | |
download | qpid-python-877e7ae368d4320bd60ba5750be207a5cac13f43.tar.gz |
* cpp/lib/broker/BrokerQueue.cpp (): Centralized exceptions.
* cpp/lib/broker/BrokerAdapter.cpp (consume): Moved exceptions to Queue
* cpp/lib/broker/BrokerChannel.cpp (consume): Moved exceptions to Queue
* cpp/lib/broker/BrokerMessageBase.cpp:
- Added getApplicationHeaders.
* cpp/lib/broker/BrokerMessageMessage.cpp:
- Fixed exchangeName/destination mix up.
- Removed redundant constructor.
- Added getApplicationHeaders
* cpp/lib/broker/MessageHandlerImpl.cpp:
- Added missing acknowledgements
- Replaced assert(0) with throw "unimplemented".
- Moved exchange existence exceptions to ExchangeRegistry
- Handle transfers with references.
* cpp/tests/Makefile.am (check): Don't run tests unless all libs built OK.
* cpp/tests/python_tests: Re-enabled python tests. Not all passing.
* python/tests/message.py (MessageTests.test_get): Replace get-ok with ok.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@504305 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/lib/broker/BrokerAdapter.cpp')
-rw-r--r-- | cpp/lib/broker/BrokerAdapter.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/cpp/lib/broker/BrokerAdapter.cpp b/cpp/lib/broker/BrokerAdapter.cpp index c9d44c7445..625dda1480 100644 --- a/cpp/lib/broker/BrokerAdapter.cpp +++ b/cpp/lib/broker/BrokerAdapter.cpp @@ -15,6 +15,8 @@ * limitations under the License. * */ +#include <boost/format.hpp> + #include "BrokerAdapter.h" #include "Connection.h" #include "Exception.h" @@ -25,6 +27,7 @@ namespace qpid { namespace broker { +using boost::format; using namespace qpid; using namespace qpid::framing; @@ -151,9 +154,11 @@ void BrokerAdapter::BrokerAdapter::QueueHandlerImpl::declare(const MethodContext } } } - if (exclusive && !queue->isExclusiveOwner(&connection)) { - throw ChannelException(405, "Cannot grant exclusive access to queue"); - } + if (exclusive && !queue->isExclusiveOwner(&connection)) + throw ChannelException( + 405, + format("Cannot grant exclusive access to queue '%s'") + % queue->getName()); if (!nowait) { string queueName = queue->getName(); connection.client->getQueue().declareOk(context, queueName, queue->getMessageCount(), queue->getConsumerCount()); @@ -248,20 +253,14 @@ void BrokerAdapter::BrokerAdapter::BasicHandlerImpl::consume( throw ConnectionException(530, "Consumer tags must be unique"); } - try{ - string newTag = consumerTag; - channel.consume( - newTag, queue, !noAck, exclusive, noLocal ? &connection : 0, &fields); + string newTag = consumerTag; + channel.consume( + newTag, queue, !noAck, exclusive, noLocal ? &connection : 0, &fields); - if(!nowait) connection.client->getBasic().consumeOk(context, newTag); - - //allow messages to be dispatched if required as there is now a consumer: - queue->dispatch(); - }catch(ExclusiveAccessException& e){ - if(exclusive) throw ChannelException(403, "Exclusive access cannot be granted"); - else throw ChannelException(403, "Access would violate previously granted exclusivity"); - } + if(!nowait) connection.client->getBasic().consumeOk(context, newTag); + //allow messages to be dispatched if required as there is now a consumer: + queue->dispatch(); } void BrokerAdapter::BrokerAdapter::BasicHandlerImpl::cancel(const MethodContext& context, const string& consumerTag, bool nowait){ |