summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/ClientSessionTest.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2009-02-12 11:43:51 +0000
committerGordon Sim <gsim@apache.org>2009-02-12 11:43:51 +0000
commiteaed6d20d8ba86a783fb8f021c4ee55953c23b6e (patch)
treeeaee10c3d7f6fd3c2285a3f17e045a7c8ab83f3e /qpid/cpp/src/tests/ClientSessionTest.cpp
parente3e41035c067bf8fa881def361eae197ecf1e4aa (diff)
downloadqpid-python-eaed6d20d8ba86a783fb8f021c4ee55953c23b6e.tar.gz
QPID-1660: If selected consumer can't take a message, ensure others are notified of message availability.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@743694 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/ClientSessionTest.cpp')
-rw-r--r--qpid/cpp/src/tests/ClientSessionTest.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/ClientSessionTest.cpp b/qpid/cpp/src/tests/ClientSessionTest.cpp
index f0c7c1d0c6..6ec73fd47c 100644
--- a/qpid/cpp/src/tests/ClientSessionTest.cpp
+++ b/qpid/cpp/src/tests/ClientSessionTest.cpp
@@ -488,6 +488,39 @@ QPID_AUTO_TEST_CASE(testResubscribeWithLocalQueue) {
BOOST_CHECK(!q.get(got));
}
+QPID_AUTO_TEST_CASE(testReliableDispatch) {
+ ClientSessionFixture fix;
+ std::string queue("a-queue");
+ fix.session.queueDeclare(arg::queue=queue, arg::autoDelete=true);
+
+ ConnectionSettings settings;
+ settings.port = fix.broker->getPort(qpid::broker::Broker::TCP_TRANSPORT);
+
+ Connection c1;
+ c1.open(settings);
+ Session s1 = c1.newSession();
+ SubscriptionManager subs1(s1);
+ LocalQueue q1;
+ subs1.subscribe(q1, queue, FlowControl());//first subscriber has no credit
+
+ Connection c2;
+ c2.open(settings);
+ Session s2 = c2.newSession();
+ SubscriptionManager subs2(s2);
+ LocalQueue q2;
+ subs2.subscribe(q2, queue);//second subscriber has credit
+
+ fix.session.messageTransfer(arg::content=Message("my-message", queue));
+
+ //check that the second consumer gets the message
+ Message got;
+ BOOST_CHECK(q2.get(got, 1*TIME_SEC));
+ BOOST_CHECK_EQUAL("my-message", got.getData());
+
+ c1.close();
+ c2.close();
+}
+
QPID_AUTO_TEST_SUITE_END()