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 cf43ec4ad34 CAMEL-19343: Add limitation to docs
cf43ec4ad34 is described below

commit cf43ec4ad34f16795b487bbe78eddfd7ee1808d4
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Mon Jul 17 07:13:01 2023 +0200

    CAMEL-19343: Add limitation to docs
---
 .../modules/ROOT/pages/route-template.adoc         | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/docs/user-manual/modules/ROOT/pages/route-template.adoc 
b/docs/user-manual/modules/ROOT/pages/route-template.adoc
index 8b08497f9a6..68b41e855ff 100644
--- a/docs/user-manual/modules/ROOT/pages/route-template.adoc
+++ b/docs/user-manual/modules/ROOT/pages/route-template.adoc
@@ -254,6 +254,40 @@ And in YAML DSL
         value: "5s"
 ----
 
+=== Using template parameters with Java DSL simple builder
+
+When using Java DSL and simple language then beware that you should
+not use the _simple fluent builder_ when defining the simple 
expressions/predicates.
+
+For example given the following route template in Java DSL:
+
+[source,java]
+----
+public class MyRouteTemplates extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        routeTemplate("myTemplate")
+            .templateParameter("name")
+            .templateParameter("color")
+            .from("direct:{{name}}")
+                .choice()
+                    .when(simple("{{color}}").isEqualTo("red"))
+                        .to("direct:red")
+                    .otherwise()
+                        .to("color:other")
+                .end();
+    }
+}
+----
+
+Then notice how the simple predicate is using _simple fluent builder_ 
`simple("{{color}}").isEqualTo("red")`.
+This is **not supported** with route templates and would not work when 
creating multiple routes from the template.
+
+Instead, the simple expression should be a literal String value _only_ as 
follows:
+
+    .when(simple("'{{color}}' == 'red'")
+
 === Using hardcoded node IDs in route templates
 
 If route templates contains hardcoded node IDs then routes created from 
templates will use the same IDs

Reply via email to