Skip to content

Commit fdc0c0d

Browse files
committed
test dead-lettering for x-message-ttl=0
1 parent 77c5f91 commit fdc0c0d

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,11 @@ public void testDeclareQueueWithRoutingKeyButNoDeadLetterExchange()
8484
}
8585

8686
public void testDeadLetterQueueTTLExpiredMessages() throws Exception {
87-
Map<String, Object> args = new HashMap<String, Object>();
88-
args.put("x-message-ttl", 1000);
87+
ttlTest(1000);
88+
}
8989

90-
deadLetterTest(new Runnable() {
91-
public void run() {
92-
sleep(2000);
93-
}
94-
}, args, "expired");
90+
public void testDeadLetterQueueZeroTTLExpiredMessages() throws Exception {
91+
ttlTest(0);
9592
}
9693

9794
public void testDeadLetterDeletedDLX() throws Exception {
@@ -309,6 +306,14 @@ public void process(GetResponse getResponse) {
309306
});
310307
}
311308

309+
private void ttlTest(final long ttl) throws Exception {
310+
Map<String, Object> args = new HashMap<String, Object>();
311+
args.put("x-message-ttl", ttl);
312+
deadLetterTest(new Runnable() {
313+
public void run() { sleep(ttl + 1000); }
314+
}, args, "expired");
315+
}
316+
312317
private void sleep(long millis) {
313318
try {
314319
Thread.sleep(millis);

0 commit comments

Comments
 (0)