This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 1d6db7c21856 CAMEL-24028: Fix flaky
JmsTransactedDeadLetterChannelNotHandlerRollbackOnExceptionIT (#24627)
1d6db7c21856 is described below
commit 1d6db7c21856c8f6130b9800aca3fc112553ec2e
Author: Guillaume Nodet <[email protected]>
AuthorDate: Sun Jul 12 22:06:00 2026 +0200
CAMEL-24028: Fix flaky
JmsTransactedDeadLetterChannelNotHandlerRollbackOnExceptionIT (#24627)
CAMEL-24028: Fix flaky
JmsTransactedDeadLetterChannelNotHandlerRollbackOnExceptionIT
Co-authored-by: Claude Opus 4.6 <[email protected]>
---
...tedDeadLetterChannelNotHandlerRollbackOnExceptionIT.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git
a/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/tx/JmsTransactedDeadLetterChannelNotHandlerRollbackOnExceptionIT.java
b/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/tx/JmsTransactedDeadLetterChannelNotHandlerRollbackOnExceptionIT.java
index 9124193b5f06..1aeb7468fc89 100644
---
a/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/tx/JmsTransactedDeadLetterChannelNotHandlerRollbackOnExceptionIT.java
+++
b/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/tx/JmsTransactedDeadLetterChannelNotHandlerRollbackOnExceptionIT.java
@@ -40,6 +40,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import static
org.apache.camel.component.jms.JmsComponent.jmsComponentTransacted;
+import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -104,9 +105,15 @@ public class
JmsTransactedDeadLetterChannelNotHandlerRollbackOnExceptionIT exten
assertTrue(notify.matches(30, TimeUnit.SECONDS), "Exchange should be
done");
// as we do not handle new exception, then the exception propagates
back
- // and causes the transaction to rollback, and we can find the message
in the DLQ
- Object dlqBody = consumer.receiveBody("activemq:" + DLQ_NAME, 10000);
- assertEquals("Hello World", dlqBody);
+ // and causes the transaction to rollback, and we can find the message
in the DLQ.
+ // Use Awaitility to retry: the transacted session may be briefly
closed after
+ // the rollback, causing "Session is closed" on the first receiveBody
attempt.
+ await().atMost(30, TimeUnit.SECONDS)
+ .ignoreExceptions()
+ .untilAsserted(() -> {
+ Object dlqBody = consumer.receiveBody("activemq:" +
DLQ_NAME, 2000);
+ assertEquals("Hello World", dlqBody);
+ });
}
@Override