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

davsclaus pushed a commit to branch camel-4.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.14.x by this push:
     new 316385f0e704 CAMEL-22998: Fix named route configurations not inherited 
by kamelets. (#21437)
316385f0e704 is described below

commit 316385f0e7040c6e57ca7bd40fad946349221ecc
Author: Bartosz Popiela <[email protected]>
AuthorDate: Fri Feb 13 09:58:51 2026 +0100

    CAMEL-22998: Fix named route configurations not inherited by kamelets. 
(#21437)
    
    CAMEL-22998: After changes introduced in scope of CAMEL-21599, kamelets 
inherit the error handler from the parent route. However, if the parent route 
has a route configuration with an error handler or an onException block, it 
won't be inherited.
---
 .../src/main/java/org/apache/camel/component/kamelet/Kamelet.java  | 1 +
 ...java => KameletNoErrorHandlerGlobalRouteConfigurationTest.java} | 6 +++---
 ...a => KameletNoErrorHandlerInheritedRouteConfigurationTest.java} | 7 ++++---
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git 
a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java
 
b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java
index 46e1b10f30f8..d3b3cda8c7ed 100644
--- 
a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java
+++ 
b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java
@@ -220,6 +220,7 @@ public final class Kamelet {
             if (wrap && parent != null && parent.isKamelet() == null) {
                 // do not wrap if the parent is also a kamelet
                 
def.setErrorHandlerFactory(parent.getErrorHandlerFactory().cloneBuilder());
+                def.setRouteConfigurationId(parent.getRouteConfigurationId());
             } else {
                 def.setErrorHandlerFactory(new NoErrorHandlerBuilder());
             }
diff --git 
a/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletNoErrorHandlerRouteConfigurationTest.java
 
b/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletNoErrorHandlerGlobalRouteConfigurationTest.java
similarity index 89%
copy from 
components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletNoErrorHandlerRouteConfigurationTest.java
copy to 
components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletNoErrorHandlerGlobalRouteConfigurationTest.java
index 5bc4891e8cf7..316918d7e2d0 100644
--- 
a/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletNoErrorHandlerRouteConfigurationTest.java
+++ 
b/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletNoErrorHandlerGlobalRouteConfigurationTest.java
@@ -22,11 +22,11 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.Test;
 
-public class KameletNoErrorHandlerRouteConfigurationTest extends 
CamelTestSupport {
+public class KameletNoErrorHandlerGlobalRouteConfigurationTest extends 
CamelTestSupport {
 
     @Test
     public void testNoErrorHandler() throws Exception {
-        getMockEndpoint("mock:dead").expectedMessageCount(1);
+        getMockEndpoint("mock:deadGlobal").expectedMessageCount(1);
 
         template.sendBody("direct:start", "Hello World");
 
@@ -50,7 +50,7 @@ public class KameletNoErrorHandlerRouteConfigurationTest 
extends CamelTestSuppor
 
             @Override
             public void configuration() throws Exception {
-                errorHandler(deadLetterChannel("mock:dead"));
+                errorHandler(deadLetterChannel("mock:deadGlobal"));
             }
         };
     }
diff --git 
a/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletNoErrorHandlerRouteConfigurationTest.java
 
b/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletNoErrorHandlerInheritedRouteConfigurationTest.java
similarity index 84%
rename from 
components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletNoErrorHandlerRouteConfigurationTest.java
rename to 
components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletNoErrorHandlerInheritedRouteConfigurationTest.java
index 5bc4891e8cf7..8b883f275c7c 100644
--- 
a/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletNoErrorHandlerRouteConfigurationTest.java
+++ 
b/components/camel-kamelet/src/test/java/org/apache/camel/component/kamelet/KameletNoErrorHandlerInheritedRouteConfigurationTest.java
@@ -22,11 +22,11 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.Test;
 
-public class KameletNoErrorHandlerRouteConfigurationTest extends 
CamelTestSupport {
+public class KameletNoErrorHandlerInheritedRouteConfigurationTest extends 
CamelTestSupport {
 
     @Test
     public void testNoErrorHandler() throws Exception {
-        getMockEndpoint("mock:dead").expectedMessageCount(1);
+        getMockEndpoint("mock:deadInherited").expectedMessageCount(1);
 
         template.sendBody("direct:start", "Hello World");
 
@@ -44,13 +44,14 @@ public class KameletNoErrorHandlerRouteConfigurationTest 
extends CamelTestSuppor
                         .throwException(new 
IllegalArgumentException("Forced"));
 
                 from("direct:start").routeId("test")
+                        .routeConfigurationId("someRouteConfiguration")
                         .to("kamelet:echo?prefix=a")
                         .log("${body}");
             }
 
             @Override
             public void configuration() throws Exception {
-                errorHandler(deadLetterChannel("mock:dead"));
+                
routeConfiguration("someRouteConfiguration").errorHandler(deadLetterChannel("mock:deadInherited"));
             }
         };
     }

Reply via email to