diff options
Diffstat (limited to 'cpp')
-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) { |