diff options
author | Carl C. Trieloff <cctrieloff@apache.org> | 2007-08-27 21:02:11 +0000 |
---|---|---|
committer | Carl C. Trieloff <cctrieloff@apache.org> | 2007-08-27 21:02:11 +0000 |
commit | 580b72becb3dc09b17fa5a887169a5e1a45348ff (patch) | |
tree | 6a4c83a5ea7f5b04d23aa0e859ecb4e3c325bdc7 /cpp/src | |
parent | d52cb3fdccb2c18fa91c8331b4a09e4ea032ff1c (diff) | |
download | qpid-python-580b72becb3dc09b17fa5a887169a5e1a45348ff.tar.gz |
- perf clean up.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@570243 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/broker/BrokerAdapter.cpp | 15 | ||||
-rw-r--r-- | cpp/src/qpid/broker/BrokerChannel.cpp | 4 |
2 files changed, 9 insertions, 10 deletions
diff --git a/cpp/src/qpid/broker/BrokerAdapter.cpp b/cpp/src/qpid/broker/BrokerAdapter.cpp index 024516fb7b..b733f77390 100644 --- a/cpp/src/qpid/broker/BrokerAdapter.cpp +++ b/cpp/src/qpid/broker/BrokerAdapter.cpp @@ -80,7 +80,6 @@ void BrokerAdapter::ChannelHandlerImpl::closeOk(){} void BrokerAdapter::ExchangeHandlerImpl::declare(uint16_t /*ticket*/, const string& exchange, const string& type, const string& alternateExchange, bool passive, bool durable, bool /*autoDelete*/, const FieldTable& args){ - Exchange::shared_ptr alternate; if (!alternateExchange.empty()) { alternate = broker.getExchanges().get(alternateExchange); @@ -198,6 +197,7 @@ QueueQueryResult BrokerAdapter::QueueHandlerImpl::query(const string& name) void BrokerAdapter::QueueHandlerImpl::declare(uint16_t /*ticket*/, const string& name, const string& alternateExchange, bool passive, bool durable, bool exclusive, bool autoDelete, const qpid::framing::FieldTable& arguments){ + Exchange::shared_ptr alternate; if (!alternateExchange.empty()) { alternate = broker.getExchanges().get(alternateExchange); @@ -345,14 +345,11 @@ void BrokerAdapter::BasicHandlerImpl::publish(uint16_t /*ticket*/, bool rejectUnroutable, bool immediate) { - Exchange::shared_ptr exchange = exchangeName.empty() ? broker.getExchanges().getDefault() : broker.getExchanges().get(exchangeName); - if(exchange){ - BasicMessage* msg = new BasicMessage(&connection, exchangeName, routingKey, rejectUnroutable, immediate); - channel.handlePublish(msg); - }else{ - throw ChannelException( - 404, "Exchange not found '" + exchangeName + "'"); - } + // exeption moved to ChannelAdaptor -- TODO this code should be removed once basic is removed + + BasicMessage* msg = new BasicMessage(&connection, exchangeName, routingKey, rejectUnroutable, immediate); + channel.handlePublish(msg); + } void BrokerAdapter::BasicHandlerImpl::get(uint16_t /*ticket*/, const string& queueName, bool noAck){ diff --git a/cpp/src/qpid/broker/BrokerChannel.cpp b/cpp/src/qpid/broker/BrokerChannel.cpp index 11d8db73f8..9712b3903f 100644 --- a/cpp/src/qpid/broker/BrokerChannel.cpp +++ b/cpp/src/qpid/broker/BrokerChannel.cpp @@ -346,7 +346,9 @@ void Channel::route(Message::shared_ptr msg, Deliverable& strategy) { cacheExchange = connection.broker.getExchanges().get(routeToExchangeName); } - assert(cacheExchange.get()); + if (!cacheExchange.get() ) + throw ChannelException(404, "Exchange not found '" + routeToExchangeName + "'"); + cacheExchange->route(strategy, msg->getRoutingKey(), &(msg->getApplicationHeaders())); if (!strategy.delivered) { |