Fix bug in the RabbitAmqpListenerTests for consumeIsDone

The logic if the `processQ1AndQ2Data()` listener method is to
collect 10 messages, where one of them is a duplication after `requeue`.
The first `discard` is accepted into `received` result, but the second is
terminated by the exception.
However, `countDown()` in the `finally` block is still called for all the cases.
Therefore, `11` times: 7 for normal data, 1 for `discard`, 2 for `requeue`, and 1 for exception.
This commit is contained in:
Artem Bilan
2025-03-11 11:05:02 -04:00
parent 30efbf7a5b
commit 3ecb055eda

View File

@@ -170,7 +170,7 @@ class RabbitAmqpListenerTests extends RabbitAmqpTestBase {
final List<String> received = Collections.synchronizedList(new ArrayList<>());
CountDownLatch consumeIsDone = new CountDownLatch(10);
CountDownLatch consumeIsDone = new CountDownLatch(11);
@RabbitListener(queues = {"q1", "q2"},
ackMode = "#{T(org.springframework.amqp.core.AcknowledgeMode).MANUAL}",