jeanouii commented on code in PR #1628:
URL: https://github.com/apache/activemq/pull/1628#discussion_r2720157963
##########
activemq-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java:
##########
@@ -1019,15 +1016,22 @@ public void testAckOfExpired() throws Exception {
Session sendSession = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = sendSession.createProducer(destination);
- producer.setTimeToLive(500);
+ final int ttl = 500;
+ producer.setTimeToLive(ttl);
final int count = 4;
for (int i = 0; i < count; i++) {
TextMessage message = sendSession.createTextMessage("" + i);
producer.send(message);
}
// let first bunch in queue expire
- Thread.sleep(1000);
+ final long expiryTime = System.currentTimeMillis() +
TimeUnit.MILLISECONDS.toMillis(ttl * 2L);
+ assertTrue("ttl elapsed", Wait.waitFor(new Wait.Condition() {
Review Comment:
Hum, I orgot something looks like.
I think the goal of the WaitFor was to actually check the value of expired
messages for the destination. In essence, instead of relying on elapsed time
from the client perspective, actually wait for the broker to process the
expired messages.
Condition would be like
`...getDestinationStatistics().getExpired().getCount() >= count`
Does that work for you?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact