File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
test/src/com/rabbitmq/client/test/functional Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1919
2020import com .rabbitmq .client .AMQP ;
2121import com .rabbitmq .client .GetResponse ;
22+ import com .rabbitmq .client .QueueingConsumer ;
2223import com .rabbitmq .client .test .BrokerTestCase ;
2324
2425import 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 );
You can’t perform that action at this time.
0 commit comments