From 15a915878c787e6d5ed8330a8dd4375ec885a6c0 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Fri, 3 Nov 2006 13:44:21 +0000 Subject: Added some methods to MessageStore interface and hooked these in where appropriate. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@470810 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/SessionHandlerImpl.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'cpp/src/qpid/broker/SessionHandlerImpl.cpp') diff --git a/cpp/src/qpid/broker/SessionHandlerImpl.cpp b/cpp/src/qpid/broker/SessionHandlerImpl.cpp index 7c94a65d73..7a03132671 100644 --- a/cpp/src/qpid/broker/SessionHandlerImpl.cpp +++ b/cpp/src/qpid/broker/SessionHandlerImpl.cpp @@ -250,24 +250,28 @@ void SessionHandlerImpl::QueueHandlerImpl::declare(u_int16_t channel, u_int16_t queue = parent->getQueue(name, channel); } else { std::pair queue_created = - parent->queues->declare(name, durable, autoDelete ? parent->timeout : 0, 0, exclusive ? parent : 0); + parent->queues->declare(name, durable, autoDelete ? parent->timeout : 0, exclusive ? parent : 0); queue = queue_created.first; assert(queue); if (queue_created.second) { // This is a new queue parent->getChannel(channel)->setDefaultQueue(queue); + + //create persistent record if required + queue_created.first->create(); + //add default binding: parent->exchanges->getDefault()->bind(queue, name, 0); - if(exclusive){ + if (exclusive) { parent->exclusiveQueues.push_back(queue); } else if(autoDelete){ parent->cleaner->add(queue); } } } - if(exclusive && !queue->isExclusiveOwner(parent)){ + if (exclusive && !queue->isExclusiveOwner(parent)) { throw ChannelException(405, "Cannot grant exclusive access to queue"); } - if(!nowait){ + if (!nowait) { name = queue->getName(); parent->client.getQueue().declareOk(channel, name, queue->getMessageCount(), queue->getConsumerCount()); } @@ -311,6 +315,7 @@ void SessionHandlerImpl::QueueHandlerImpl::delete_(u_int16_t channel, u_int16_t if(i < parent->exclusiveQueues.end()) parent->exclusiveQueues.erase(i); } count = q->getMessageCount(); + q->destroy(); parent->queues->destroy(queue); } if(!nowait) parent->client.getQueue().deleteOk(channel, count); -- cgit v1.2.1