File tree 1 file changed +19
-0
lines changed
test/src/com/rabbitmq/client/test/functional 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -58,4 +58,23 @@ public void testExpiryWhenConsumerIsLateToTheParty() throws Exception {
58
58
assertNull ("Message should have been expired!!" , c .nextDelivery (100 ));
59
59
}
60
60
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
+
61
80
}
You can’t perform that action at this time.
0 commit comments