Skip to content

Commit 31d5488

Browse files
committed
a test
1 parent 627345d commit 31d5488

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import com.rabbitmq.client.AMQP;
2121
import com.rabbitmq.client.GetResponse;
22+
import com.rabbitmq.client.QueueingConsumer;
2223
import com.rabbitmq.client.test.BrokerTestCase;
2324

2425
import java.io.IOException;
@@ -175,6 +176,23 @@ public void testExpiryWithRequeue() throws Exception {
175176
expectBodyAndRemainingMessages(MSG[2], 0);
176177
}
177178

179+
/*
180+
* Test expiry of requeued messages after being consumed instantly
181+
*/
182+
public void testExpiryWithRequeueAfterConsume() throws Exception {
183+
declareAndBindQueue(100);
184+
QueueingConsumer c = new QueueingConsumer(channel);
185+
channel.basicConsume(TTL_QUEUE_NAME, c);
186+
187+
publish(MSG[0]);
188+
assertNotNull(c.nextDelivery());
189+
190+
closeChannel();
191+
Thread.sleep(150);
192+
openChannel();
193+
194+
assertNull("Requeued message not expired", get());
195+
}
178196

179197
private String get() throws IOException {
180198
GetResponse response = basicGet(TTL_QUEUE_NAME);

0 commit comments

Comments
 (0)