diff options
author | Jonathan Robie <jonathan@apache.org> | 2010-10-04 18:51:13 +0000 |
---|---|---|
committer | Jonathan Robie <jonathan@apache.org> | 2010-10-04 18:51:13 +0000 |
commit | a7fcaf6d897eb38dc1d8b90a3b649a1e535fb1f3 (patch) | |
tree | e3a5c67c05bc16371259b47d5707e0ca7d0660db | |
parent | 29ec6a102147f1cbed389a64ac81c90ce437a606 (diff) | |
download | qpid-python-a7fcaf6d897eb38dc1d8b90a3b649a1e535fb1f3.tar.gz |
Allows browsing of exclusive queues held by another session.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1004357 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/broker/SessionAdapter.cpp | 3 | ||||
-rw-r--r-- | qpid/cpp/src/tests/MessagingSessionTests.cpp | 19 |
2 files changed, 21 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/broker/SessionAdapter.cpp b/qpid/cpp/src/qpid/broker/SessionAdapter.cpp index 2effa03afb..d4f6b28ccb 100644 --- a/qpid/cpp/src/qpid/broker/SessionAdapter.cpp +++ b/qpid/cpp/src/qpid/broker/SessionAdapter.cpp @@ -489,7 +489,8 @@ SessionAdapter::MessageHandlerImpl::subscribe(const string& queueName, Queue::shared_ptr queue = getQueue(queueName); if(!destination.empty() && state.exists(destination)) throw NotAllowedException(QPID_MSG("Consumer tags must be unique")); - if (queue->hasExclusiveOwner() && !queue->isExclusiveOwner(&session)) + + if (queue->hasExclusiveOwner() && !queue->isExclusiveOwner(&session) && acquireMode == 0) throw ResourceLockedException(QPID_MSG("Cannot subscribe to exclusive queue " << queue->getName())); diff --git a/qpid/cpp/src/tests/MessagingSessionTests.cpp b/qpid/cpp/src/tests/MessagingSessionTests.cpp index 66ce061b73..fc1632b4e1 100644 --- a/qpid/cpp/src/tests/MessagingSessionTests.cpp +++ b/qpid/cpp/src/tests/MessagingSessionTests.cpp @@ -771,6 +771,25 @@ QPID_AUTO_TEST_CASE(testExclusiveSubscriber) } catch (const MessagingException& /*e*/) {} } + +QPID_AUTO_TEST_CASE(testExclusiveQueueSubscriberAndBrowser) +{ + MessagingFixture fix; + + std::string address = "exclusive-queue; { create: receiver, node : { x-declare : { auto-delete: true, exclusive: true } } }"; + std::string browseAddress = "exclusive-queue; { mode: browse }"; + + Receiver receiver = fix.session.createReceiver(address); + fix.session.sync(); + + Connection c2 = fix.newConnection(); + c2.open(); + Session s2 = c2.createSession(); + + BOOST_CHECK_NO_THROW(Receiver browser = s2.createReceiver(browseAddress)); + c2.close(); +} + QPID_AUTO_TEST_CASE(testAuthenticatedUsername) { MessagingFixture fix; |