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 b8731603f26b CAMEL-23980: Fix flaky JmsAddAndRemoveRouteManagementIT
b8731603f26b is described below
commit b8731603f26bbe4ee20e53305ac053cc94f1dd23
Author: Guillaume Nodet <[email protected]>
AuthorDate: Sat Jul 11 00:28:08 2026 +0200
CAMEL-23980: Fix flaky JmsAddAndRemoveRouteManagementIT
Fix flaky JmsAddAndRemoveRouteManagementIT (14% failure rate on Develocity).
Race between route Started status and JMS consumer readiness: after
addRoutes(), thread pool registration in JMX does not guarantee the
JMS consumer has subscribed to the broker. Use the shared
JmsTestHelper.waitForJmsConsumerRoutes() helper and increase
MockEndpoint.setResultWaitTime to 30 s.
Post-fix validation: 30/30 PASS (0% failure rate).
Co-authored-by: Claude Opus 4.6 <[email protected]>
---
.../jms/integration/JmsAddAndRemoveRouteManagementIT.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git
a/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/JmsAddAndRemoveRouteManagementIT.java
b/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/JmsAddAndRemoveRouteManagementIT.java
index 42b91af22429..082dafd56f86 100644
---
a/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/JmsAddAndRemoveRouteManagementIT.java
+++
b/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/JmsAddAndRemoveRouteManagementIT.java
@@ -29,6 +29,7 @@ import org.apache.camel.ConsumerTemplate;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.jms.AbstractJMSTest;
+import org.apache.camel.component.jms.JmsTestHelper;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.test.infra.core.CamelContextExtension;
@@ -75,7 +76,11 @@ public class JmsAddAndRemoveRouteManagementIT extends
AbstractJMSTest {
Set<ObjectName> before = mbeanServer.queryNames(query, null);
- getMockEndpoint("mock:result").expectedMessageCount(1);
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(1);
+ // Allow extra time for the JMS consumer to subscribe to the broker
+ // after the route is started (the default 10 s can be too short on
slow CI)
+ mock.setResultWaitTime(30_000);
context.addRoutes(new RouteBuilder() {
@Override
@@ -96,6 +101,10 @@ public class JmsAddAndRemoveRouteManagementIT extends
AbstractJMSTest {
duringRef.set(during);
});
+ // Wait for the JMS consumer to actually subscribe to the broker —
+ // thread pool registration in JMX does not guarantee the listener is
ready
+ JmsTestHelper.waitForJmsConsumerRoutes(context, "myNewRoute");
+
// Identify the thread pools added by the new route
Set<ObjectName> addedPools = new HashSet<>(duringRef.get());
addedPools.removeAll(before);