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 2021/12/04 11:04:43 UTC

[camel] branch main updated: CAMEL-17272: camel-spring-xml - Classic Spring XML add support for external route configuration XML files

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 54cdb08  CAMEL-17272: camel-spring-xml - Classic Spring XML add support for external route configuration XML files
54cdb08 is described below

commit 54cdb089a60f655ab7887e82d79dd20dea32f64f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Dec 4 12:04:12 2021 +0100

    CAMEL-17272: camel-spring-xml - Classic Spring XML add support for external route configuration XML files
---
 .../modules/ROOT/pages/route-configuration.adoc    | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/docs/user-manual/modules/ROOT/pages/route-configuration.adoc b/docs/user-manual/modules/ROOT/pages/route-configuration.adoc
index 957b921..8e8b13d 100644
--- a/docs/user-manual/modules/ROOT/pages/route-configuration.adoc
+++ b/docs/user-manual/modules/ROOT/pages/route-configuration.adoc
@@ -252,6 +252,45 @@ In this example the route is assigned the _yamlError_ route configuration by the
 Routes and route configuration are not required to use the same language. For example you can code
 route configurations in Java, and then use XML DSL for the routes, and they would work together.
 
+== Route Configuration in classic Spring/Blueprint XML
+
+When using XML DSL with `camel-spring-xml` or `camel-blueprint`
+then you can code your route configurations in `<routeConfigurationContext>` snippets
+in sepearte XML files as shown below:
+
+[source,xml]
+----
+<routeConfigurationContext id="myConf" xmlns="http://camel.apache.org/schema/spring">
+    <routeConfiguration id="xmlError">
+        <onException>
+            <exception>java.lang.Exception</exception>
+            <handled><constant>true</constant></handled>
+            <log message="XML WARN: ${exception.message}"/>
+        </onException>
+    </routeConfiguration>
+</routeConfigurationContext>
+----
+
+Then from `<camelContext>` you can refer to these XML snippets by their ids:
+
+[source,xml]
+----
+<camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring">
+
+    <!-- refer to the ID on the context that has the route configurations (see above) -->
+    <routeConfigurationContextRef ref="myConf"/>
+
+    <!-- routes can then assign which configuration to use -->
+    <route routeConfigurationId="xmlError">
+        <from uri="timer:xml?period=5s"/>
+        <log message="I am XML"/>
+        <throwException exceptionType="java.lang.Exception" message="Some kind of XML error"/>
+    </route>
+</route>
+----
+
+In this example the route is assigned the _xmlError_ route configuration by the exact ID.
+
 == Packaging route configurations in reusable JARs
 
 You can package common route configurations into JARs which you can then use together with