diff options
Diffstat (limited to 'cpp/src/qpid/broker/BrokerQueue.cpp')
-rw-r--r-- | cpp/src/qpid/broker/BrokerQueue.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/cpp/src/qpid/broker/BrokerQueue.cpp b/cpp/src/qpid/broker/BrokerQueue.cpp index cf6beff375..f8bffa01a3 100644 --- a/cpp/src/qpid/broker/BrokerQueue.cpp +++ b/cpp/src/qpid/broker/BrokerQueue.cpp @@ -56,8 +56,15 @@ Queue::Queue(const string& _name, bool _autodelete, Queue::~Queue(){} void Queue::deliver(Message::shared_ptr& msg){ - enqueue(0, msg); - process(msg); + if (msg->isImmediate() && getConsumerCount() == 0) { + if (alternateExchange) { + DeliverableMessage deliverable(msg); + alternateExchange->route(deliverable, msg->getRoutingKey(), &(msg->getApplicationHeaders())); + } + } else { + enqueue(0, msg); + process(msg); + } } void Queue::recover(Message::shared_ptr& msg){ @@ -255,6 +262,7 @@ void Queue::destroy() &(msg.getMessage().getApplicationHeaders())); pop(); } + alternateExchange->decAlternateUsers(); } if (store) { @@ -318,3 +326,8 @@ void Queue::setAlternateExchange(boost::shared_ptr<Exchange> exchange) { alternateExchange = exchange; } + +boost::shared_ptr<Exchange> Queue::getAlternateExchange() +{ + return alternateExchange; +} |