O'Reilly logo

Just Spring Integration by Madhusudhan Konda

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required