Warning

This component has been deprecated in favor to servicemix-scripting component.

ServiceMix has a ScriptComponent which allows you to easily script In or InOut message exchanges using any JSR 223 compliant scripting engine such as Groovy, JavaScript, Jython etc.

You can provide a custom component by deriving from this component, or just deploy it and configure the script language name along with the script.

There are a few examples using the Groovy support.

Variables available

While inside the script you have a access to the JBI scopes as follows.

Variable Description
context The JBI ComponentContext
deliveryChannel the DeliveryChannel
exchange The JBI MessageExchange
inMessage The in message
bindings A Map which is maintained across invocations for the component which allows you to share state across requests. This state is not persistent, but will last for the duration of the JVM