Skip to content

Commit 3ecb055

Browse files
committed
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.
1 parent 30efbf7 commit 3ecb055

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-rabbitmq-client/src/test/java/org/springframework/amqp/rabbitmq/client/listener/RabbitAmqpListenerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ RabbitAmqpListenerContainerFactory rabbitAmqpListenerContainerFactory(AmqpConnec
170170

171171
final List<String> received = Collections.synchronizedList(new ArrayList<>());
172172

173-
CountDownLatch consumeIsDone = new CountDownLatch(10);
173+
CountDownLatch consumeIsDone = new CountDownLatch(11);
174174

175175
@RabbitListener(queues = {"q1", "q2"},
176176
ackMode = "#{T(org.springframework.amqp.core.AcknowledgeMode).MANUAL}",

0 commit comments

Comments
 (0)