This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch 3.20.x in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 196d293f2cea3041e4110ee79bf3d0cfc9490ae5 Author: James Netherton <jamesnether...@gmail.com> AuthorDate: Fri Apr 11 09:20:05 2025 +0100 Document groovy extension limitations for property placeholders in native mode --- .../ROOT/pages/reference/extensions/groovy.adoc | 28 ++++++++++++++++++---- .../groovy/runtime/src/main/doc/limitations.adoc | 27 +++++++++++++++++---- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/docs/modules/ROOT/pages/reference/extensions/groovy.adoc b/docs/modules/ROOT/pages/reference/extensions/groovy.adoc index 8a8fe60be2..75474be117 100644 --- a/docs/modules/ROOT/pages/reference/extensions/groovy.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/groovy.adoc @@ -48,13 +48,31 @@ endif::[] [id="extensions-groovy-camel-quarkus-limitations"] == Camel Quarkus limitations -Due to some limitations in GraalVM that prevent to execute even basic scripts in native mode, the compilation of the -Groovy expressions is made with the static compilation enabled which means that the types used in your expression must +[id="extensions-groovy-limitations-native-mode-limitations"] +=== Native mode limitations + +Compilation of Groovy expressions is made with static compilation enabled. Which means that the types used in your expressions must be known at compile time. Please refer to the https://docs.groovy-lang.org/latest/html/documentation/core-semantics.html#static-type-checking[Groovy documentation for more details]. This primarily impacts the customization of the Groovy Shell and the handling of exchange information. In native mode, customizing the Groovy Shell and accessing the following exchange variables will not function as expected. -``` -header, variable, variables, exchangeProperty, exchangeProperties, log, attachment -``` + +* `attachment` +* `exchangeProperty` +* `exchangeProperties` +* `header` +* `log` +* `variable` +* `variables` + +If you use property placeholders within your expressions like. + +[source,java] +---- +from("direct:start") + .transform().groovy("println '{{greeting.message}}'"); +---- + +`greeting.message` will be evaluated once at build time and its value will be permanently stored in the native image. +It is not possible to override the value of the property at runtime. Attempting to do so will result in an exception being thrown. diff --git a/extensions/groovy/runtime/src/main/doc/limitations.adoc b/extensions/groovy/runtime/src/main/doc/limitations.adoc index 1681d0d654..a1ee823550 100644 --- a/extensions/groovy/runtime/src/main/doc/limitations.adoc +++ b/extensions/groovy/runtime/src/main/doc/limitations.adoc @@ -1,9 +1,26 @@ -Due to some limitations in GraalVM that prevent to execute even basic scripts in native mode, the compilation of the -Groovy expressions is made with the static compilation enabled which means that the types used in your expression must +=== Native mode limitations + +Compilation of Groovy expressions is made with static compilation enabled. Which means that the types used in your expressions must be known at compile time. Please refer to the https://docs.groovy-lang.org/latest/html/documentation/core-semantics.html#static-type-checking[Groovy documentation for more details]. This primarily impacts the customization of the Groovy Shell and the handling of exchange information. In native mode, customizing the Groovy Shell and accessing the following exchange variables will not function as expected. -``` -header, variable, variables, exchangeProperty, exchangeProperties, log, attachment -``` \ No newline at end of file + +* `attachment` +* `exchangeProperty` +* `exchangeProperties` +* `header` +* `log` +* `variable` +* `variables` + +If you use property placeholders within your expressions like. + +[source,java] +---- +from("direct:start") + .transform().groovy("println '{{greeting.message}}'"); +---- + +`greeting.message` will be evaluated once at build time and its value will be permanently stored in the native image. +It is not possible to override the value of the property at runtime. Attempting to do so will result in an exception being thrown.