File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
test/src/com/rabbitmq/client/test/functional Expand file tree Collapse file tree 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 {
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}
You can’t perform that action at this time.
0 commit comments