Scripting Support
Spring Integration components can leverage Framework’s extensive support for scripting languages. You can write scripts in your favorite Framework-supported language and invoke those scripts from its endpoints. In fact, you can use any scripting language that implements JSR-223 (Scripting for Java Platform). Some of the languages Framework supports are Groovy, Python/Jython, Ruby/JRuby, and JavaScript.
Let’s take an example of a Transformer that calls a Groovy script
for transformation. The endpoint picks up the message from the in-channel and passes it to the position-transformer.groovy script.
<int:transformer input-channel="in-channel" output-channel="stdout"> <int-script:script lang="groovy" location="/home/mkonda/justspring/jsi/position-transformer.groovy"/> </int:transformer>
The script will have access to the MessageHeaders and Payload of the Message in its execution context via headers and payload variables. You can also embed your
script inline as CDATA in your
config file.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access