Skip to content

Commit bf446db

Browse files
author
Simon MacMullen
committed
stable to default
2 parents 6be5afb + ed55ed4 commit bf446db

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,23 @@ public void testExpiryWhenConsumerIsLateToTheParty() throws Exception {
5858
assertNull("Message should have been expired!!", c.nextDelivery(100));
5959
}
6060

61+
public void testRestartingExpiry() throws Exception {
62+
final String expiryDelay = "2000";
63+
declareDurableQueue(TTL_QUEUE_NAME);
64+
bindQueue();
65+
channel.basicPublish(TTL_EXCHANGE, TTL_QUEUE_NAME,
66+
MessageProperties.MINIMAL_PERSISTENT_BASIC
67+
.builder()
68+
.expiration(expiryDelay)
69+
.build(), new byte[]{});
70+
long expiryStartTime = System.currentTimeMillis();
71+
restart();
72+
long timeToExpiry = Integer.parseInt(expiryDelay) - (System.currentTimeMillis() - expiryStartTime);
73+
if (timeToExpiry > 0L) {
74+
Thread.sleep(timeToExpiry);
75+
}
76+
assertNull("Message should have expired after broker restart", get());
77+
deleteQueue(TTL_QUEUE_NAME);
78+
}
79+
6180
}

0 commit comments

Comments
 (0)