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-kamelets-examples.git


The following commit(s) were added to refs/heads/main by this push:
     new ee86aee  CAMEL-20406: Route scoped variables
ee86aee is described below

commit ee86aee27c45989a0e574457331d4e363e69d437
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sat Feb 10 13:51:13 2024 +0100

    CAMEL-20406: Route scoped variables
---
 jbang/variables/application.properties | 2 +-
 jbang/variables/myapp.java             | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/jbang/variables/application.properties 
b/jbang/variables/application.properties
index ac301bd..1a59ed7 100644
--- a/jbang/variables/application.properties
+++ b/jbang/variables/application.properties
@@ -1,3 +1,3 @@
 # variables can be pre-configured on startup
 camel.variable.greeting = Random number
-camel.variable.random = 999
+camel.variable.route.second.random.number = 999
diff --git a/jbang/variables/myapp.java b/jbang/variables/myapp.java
index 1f10ce3..f4374c5 100644
--- a/jbang/variables/myapp.java
+++ b/jbang/variables/myapp.java
@@ -8,10 +8,10 @@ public class myapp extends RouteBuilder {
     public void configure() throws Exception {
         from("timer:java")
             .setVariable("global:app", simple("${camelId}"))
-            .setVariable("global:random", simple("${random(1,10)}"));
+            .setVariable("route:second:random.number", 
simple("${random(1,10)}"));
 
-        from("timer:random?period={{time:1000}}")
-            .setBody(simple("${variable.global:greeting}: 
${variable.global:random}"))
+        from("timer:random?period={{time:1000}}").routeId("second")
+            .setBody(simple("${variable.global:greeting}: 
${variable.route:random.number}"))
             .log("${body}");
 
     }

Reply via email to