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 030729e  CAMEL-19749: Add variables as concept to Camel
030729e is described below

commit 030729ee7e32cb01e5388783b8cf81b8b1a0ee78
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sun Dec 31 11:00:05 2023 +0100

    CAMEL-19749: Add variables as concept to Camel
---
 jbang/variables/application.properties | 3 +++
 jbang/variables/myapp.java             | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/jbang/variables/application.properties 
b/jbang/variables/application.properties
new file mode 100644
index 0000000..ac301bd
--- /dev/null
+++ b/jbang/variables/application.properties
@@ -0,0 +1,3 @@
+# variables can be pre-configured on startup
+camel.variable.greeting = Random number
+camel.variable.random = 999
diff --git a/jbang/variables/myapp.java b/jbang/variables/myapp.java
index 6f684e8..1f10ce3 100644
--- a/jbang/variables/myapp.java
+++ b/jbang/variables/myapp.java
@@ -11,7 +11,7 @@ public class myapp extends RouteBuilder {
             .setVariable("global:random", simple("${random(1,10)}"));
 
         from("timer:random?period={{time:1000}}")
-            .setBody(simple("Random number: ${variable.global:random}"))
+            .setBody(simple("${variable.global:greeting}: 
${variable.global:random}"))
             .log("${body}");
 
     }

Reply via email to