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

apupier 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 56e61554751c CAMEL-27504: camel-spring-rabbitmq - Fix flaky 
RabbitMQProducerInvalidExchangeIT
56e61554751c is described below

commit 56e61554751cf54d6f6c235c1e249b295ebbab30
Author: AurĂ©lien Pupier <[email protected]>
AuthorDate: Tue Nov 24 09:18:14 2026 +0100

    CAMEL-27504: camel-spring-rabbitmq - Fix flaky 
RabbitMQProducerInvalidExchangeIT
    
    The test publishes to an unknown exchange, so RabbitMQ closes the channel.
    Depending on timing, the root cause seen by the test is either the
    ShutdownSignalException itself, or an AmqpException 
"PublisherCallbackChannel
    is closed" thrown by Spring AMQP from waitForConfirms once the channel has
    already been closed by the broker. Both mean the broker rejected the 
publish.
    
    The test only accepted the first one, and started to fail intermittently
    since the parallel build was activated. Accept both root causes, restricting
    the AmqpException to the "PublisherCallbackChannel is closed" message.
    
    Co-authored-by: IBM Bob 2.2.1
    Signed-off-by: AurĂ©lien Pupier <[email protected]>
---
 .../integration/RabbitMQProducerInvalidExchangeIT.java            | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerInvalidExchangeIT.java
 
b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerInvalidExchangeIT.java
index 5ac94b0f051e..c0bccf7b6edb 100644
--- 
a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerInvalidExchangeIT.java
+++ 
b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerInvalidExchangeIT.java
@@ -22,6 +22,7 @@ import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
+import org.springframework.amqp.AmqpException;
 import org.springframework.amqp.core.AmqpAdmin;
 import org.springframework.amqp.core.BindingBuilder;
 import org.springframework.amqp.core.Queue;
@@ -52,7 +53,12 @@ public class RabbitMQProducerInvalidExchangeIT extends 
RabbitMQITSupport {
 
         final CamelExecutionException exception = 
Assertions.assertThrows(CamelExecutionException.class,
                 () -> template.sendBody("direct:start", "Hello World"));
-        
assertThat(exception).hasRootCauseInstanceOf(ShutdownSignalException.class);
+        // RabbitMQ closes the channel when publishing to an unknown exchange: 
depending on timing the producer either
+        // sees the ShutdownSignalException itself, or Spring AMQP reports 
that the channel was already closed
+        assertThat(exception).rootCause().satisfiesAnyOf(
+                cause -> 
assertThat(cause).isInstanceOf(ShutdownSignalException.class),
+                cause -> assertThat(cause).isInstanceOf(AmqpException.class)
+                        .hasMessageContaining("PublisherCallbackChannel is 
closed"));
     }
 
     @Override

Reply via email to