You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/03/29 13:55:34 UTC
[camel] 02/03: CAMEL-18923: camel-xml-jaxb-dsl - Fix bug with updating route configuration. Thanks to Raymond for reporting and test case.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b9fb1c54d8bfbd7986cf722026a8204d40aececf
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Mar 29 15:28:41 2023 +0200
CAMEL-18923: camel-xml-jaxb-dsl - Fix bug with updating route configuration. Thanks to Raymond for reporting and test case.
---
.../org/apache/camel/dsl/xml/jaxb/JaxbXmlRoutesBuilderLoader.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/dsl/camel-xml-jaxb-dsl/src/main/java/org/apache/camel/dsl/xml/jaxb/JaxbXmlRoutesBuilderLoader.java b/dsl/camel-xml-jaxb-dsl/src/main/java/org/apache/camel/dsl/xml/jaxb/JaxbXmlRoutesBuilderLoader.java
index 544c7b179ac..cc3c9828676 100644
--- a/dsl/camel-xml-jaxb-dsl/src/main/java/org/apache/camel/dsl/xml/jaxb/JaxbXmlRoutesBuilderLoader.java
+++ b/dsl/camel-xml-jaxb-dsl/src/main/java/org/apache/camel/dsl/xml/jaxb/JaxbXmlRoutesBuilderLoader.java
@@ -23,7 +23,6 @@ import org.apache.camel.api.management.ManagedResource;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.builder.RouteConfigurationBuilder;
import org.apache.camel.dsl.support.RouteBuilderLoaderSupport;
-import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.model.RouteConfigurationDefinition;
import org.apache.camel.model.RouteConfigurationsDefinition;
import org.apache.camel.model.RouteDefinition;
@@ -79,10 +78,10 @@ public class JaxbXmlRoutesBuilderLoader extends RouteBuilderLoaderSupport {
try (InputStream is = resourceInputStream(resource)) {
RoutesDefinition routes = loadRoutesDefinition(getCamelContext(), is);
if (routes != null) {
- CamelContextAware.trySetCamelContext(getRouteCollection(), getCamelContext());
// xml routes must be prepared in the same way java-dsl (via RoutesDefinition)
// so create a copy and use the fluent builder to add the route
for (RouteDefinition route : routes.getRoutes()) {
+ CamelContextAware.trySetCamelContext(route, getCamelContext());
getRouteCollection().route(route);
}
}
@@ -96,7 +95,7 @@ public class JaxbXmlRoutesBuilderLoader extends RouteBuilderLoaderSupport {
if (configurations != null) {
for (RouteConfigurationDefinition config : configurations.getRouteConfigurations()) {
CamelContextAware.trySetCamelContext(config, getCamelContext());
- ((ModelCamelContext) getCamelContext()).addRouteConfiguration(config);
+ getRouteConfigurationCollection().routeConfiguration(config);
}
}
}