Skip to content

Commit c9c440f

Browse files
author
Matthias Radestock
committed
test repeated consumer subscription and cancellation
this covers a few hitherto untraced areas of the code
1 parent 6fc2d90 commit c9c440f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/src/com/rabbitmq/client/test/functional/QosTests.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,28 @@ public void testFairness()
159159

160160
}
161161

162+
public void testConsumerLifecycle()
163+
throws IOException
164+
{
165+
channel.basicQos(1);
166+
QueueingConsumer c = new QueueingConsumer(channel);
167+
String queue = "qosTest";
168+
channel.queueDeclare(queue, false);
169+
channel.queueBind(queue, "amq.fanout", "");
170+
fill(3);
171+
String tag;
172+
for (int i = 0; i < 2; i++) {
173+
tag = channel.basicConsume(queue, false, c);
174+
Queue<Delivery> d = drain(c, 1);
175+
channel.basicCancel(tag);
176+
drain(c, 0);
177+
ack(d, true);
178+
drain(c, 0);
179+
}
180+
channel.queueDelete(queue);
181+
}
182+
183+
162184
public void testSetLimitAfterConsume()
163185
throws IOException
164186
{

0 commit comments

Comments
 (0)