This is an automated email from the ASF dual-hosted git repository.

davsclaus 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 6ca618f3cc7c CAMEL-27105: camel-jms - fix flaky 
ActiveMQConsumeWildcardQueuesIT (#30333)
6ca618f3cc7c is described below

commit 6ca618f3cc7c6c544e9082f084d1d7a55ca00050
Author: Torsten Mielke <[email protected]>
AuthorDate: Wed Nov 18 13:19:53 2026 +0100

    CAMEL-27105: camel-jms - fix flaky ActiveMQConsumeWildcardQueuesIT (#30333)
    
    The wildcard consumer's queue binding on the embedded Artemis broker can
    still be registering when the test's first send creates a brand-new
    address, so that message is silently routed only to its own private
    auto-created queue and never reaches the wildcard consumer. Confirmed via
    local reproduction with broker-level logging (see JIRA for details).
    
    Send a throwaway warm-up probe and wait for it to round-trip through the
    wildcard consumer before sending the real test messages, so the binding
    is confirmed live first. The wait times out safely rather than hanging,
    since by then the registration will be complete either way.
    
    Co-Authored-By: Claude Sonnet 5 <[email protected]>
---
 .../activemq/ActiveMQConsumeWildcardQueuesIT.java    | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git 
a/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/activemq/ActiveMQConsumeWildcardQueuesIT.java
 
b/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/activemq/ActiveMQConsumeWildcardQueuesIT.java
index 28c0e9cae068..71af71256ba9 100644
--- 
a/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/activemq/ActiveMQConsumeWildcardQueuesIT.java
+++ 
b/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/activemq/ActiveMQConsumeWildcardQueuesIT.java
@@ -16,9 +16,12 @@
  */
 package org.apache.camel.component.jms.integration.activemq;
 
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.ConsumerTemplate;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.jms.AbstractJMSTest;
 import org.apache.camel.component.mock.MockEndpoint;
@@ -28,12 +31,16 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Order;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * ActiveMQ specific unit test
  */
 public class ActiveMQConsumeWildcardQueuesIT extends AbstractJMSTest {
 
+    private static final Logger LOG = 
LoggerFactory.getLogger(ActiveMQConsumeWildcardQueuesIT.class);
+
     @Order(2)
     @RegisterExtension
     public static CamelContextExtension camelContextExtension = new 
DefaultCamelContextExtension();
@@ -43,6 +50,19 @@ public class ActiveMQConsumeWildcardQueuesIT extends 
AbstractJMSTest {
 
     @Test
     public void testWildcard() throws Exception {
+        // Warm-up probe for CAMEL-27105: right after route startup there is a 
brief window
+        // where the broker's wildcard consumer isn't fully registered yet, so 
a message to
+        // a brand-new matching address can be silently dropped. Wait for this 
throwaway
+        // probe to round-trip (or time out) before trusting the real sends 
below.
+        NotifyBuilder ready = new NotifyBuilder(context).whenDone(1).create();
+        template.sendBody("activemq:queue:sport.warmup", "warmup");
+        if (!ready.matches(3, TimeUnit.SECONDS)) {
+            LOG.info("Warm-up probe for the wildcard consumer 
(activemq:queue:sport.#) did not arrive within 3s;"
+                     + " proceeding anyway (see CAMEL-27105)");
+        }
+        ready.destroy();
+        getMockEndpoint("mock:other").reset();
+
         MockEndpoint chelsea = getMockEndpoint("mock:chelsea");
         chelsea.expectedBodiesReceived("B");
         MockEndpoint first = getMockEndpoint("mock:1st");

Reply via email to