You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jo...@apache.org on 2010/10/04 20:51:13 UTC
svn commit: r1004357 - in /qpid/trunk/qpid/cpp/src:
qpid/broker/SessionAdapter.cpp tests/MessagingSessionTests.cpp
Author: jonathan
Date: Mon Oct 4 18:51:13 2010
New Revision: 1004357
URL: http://svn.apache.org/viewvc?rev=1004357&view=rev
Log:
Allows browsing of exclusive queues held by another session.
Modified:
qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp
qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp
Modified: qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp?rev=1004357&r1=1004356&r2=1004357&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp Mon Oct 4 18:51:13 2010
@@ -489,7 +489,8 @@ SessionAdapter::MessageHandlerImpl::subs
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()));
Modified: qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp?rev=1004357&r1=1004356&r2=1004357&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp Mon Oct 4 18:51:13 2010
@@ -771,6 +771,25 @@ QPID_AUTO_TEST_CASE(testExclusiveSubscri
} 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;
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org