...
Code Block |
|
.setHeader("myHeader").groovy("resource:classpath:mygroovy.groovy")
|
How to get the result from multiple statements script
Available as of Camel 2.14
As the scripteengine evale method just return a Null if it runs a multiple statments script. Camel now look up the value of script result by using the key of "result" from the value set. If you have multiple statements script, you need to make sure you set the value of result variable as the script return value.
Code Block |
|
bar = "baz";
// some other statements ...
result = body * 2 + 1
|
Dependencies
To use scripting languages in your camel routes you need to add the a dependency on camel-script which integrates the JSR-223 scripting engine.
...