This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch var-route in repository https://gitbox.apache.org/repos/asf/camel.git
commit bdcb92632ca9bbdcfeb4cae69a8963ad1677d440 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sat Feb 10 13:54:15 2024 +0100 CAMEL-20406: Route scoped variables --- docs/user-manual/modules/ROOT/pages/variables.adoc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/user-manual/modules/ROOT/pages/variables.adoc b/docs/user-manual/modules/ROOT/pages/variables.adoc index 1a6b96b5394..9c3dc1a9a38 100644 --- a/docs/user-manual/modules/ROOT/pages/variables.adoc +++ b/docs/user-manual/modules/ROOT/pages/variables.adoc @@ -182,7 +182,7 @@ from("direct:second").routeId("second") == Configuring initial variables on startup -When Camel is starting then it's possible to configure initial variables. +When Camel is starting then it's possible to configure initial variables for `global` and `route` repositories only. This can be done in `application.properties` as shown below: @@ -192,17 +192,18 @@ camel.variable.greeting = Random number camel.variable.random = 999 ---- -The variables are default set on the `global` repository, but you can specify a custom repository by -prefixing with `id:` in the key, such as below: +The variables are default set on the `global` repository, but you can set route scoped variables, +using `route.` as prefix. As we cannot use colon (`:`) in property keys, then dot is used to separate +the route id from the variable name, eg `myRoute.gold`. [source,properties] ---- -camel.variable.acme:gold = true +camel.variable.route.myRoute.gold = true camel.variable.greeting = Random number camel.variable.random = 999 ---- -Here the gold variable is set on the `acme` repository, and the other variables are set on the `global` repository. +Here the gold variable is set on the `route` repository, and the other variables are set on the `global` repository. The value of a variable can also be loaded from file system, such as a JSon file. To do this you should prefix the value with `resource:file:` or `resource:classpath:` to load from file system or classpath,