Groovy Shell Service - execute Groovy Scripts within SonicES

Posted by Admin on 24-Jan-2008 12:27


Simply put..This service allows developers to execute Groovy Scripts (essentially Java) within an ESB Service Instance.

Send a text message or multipart message to the service where Part(0) of the message contains the Groovy Script you would like the service to invoke. This service executes the script from Part(0) of the message and passes the original message (unchanged) received by the Entry Endpoint to the Groovy Script from Part(0). Because you now have a reference to the original message you may do whatever you wish. Essentially the Groovy Script now acts as the “service” method within a custom built service.


Scenario 1: Pass a Groovy Script in Part(0) and a XML document in Part(1) - Because you have the original message in the Groovy Script you can access the XML payload and perform operations on the XML part. (Use SQL to update databases, Create additional messages, Enrich the content, perform TransformationsÂ…etc..)

Scenario 2: Pass Groovy Script in Part(0..n) and have the Groovy Script in Part(0) execute Groovy Scripts from Parts(1..n)

Leverage the simplicity and scripting functionality from Groovy within SonicÂ…

I included quick samples within the Service Document which demonstrate accessing Sonic Messages within the Groovy Script

For those which are not familiar with GroovyÂ… I highly encourage you check it outÂ…

Groovy Homepage: XML wonderfullyÂ…)

Note: this zip file may seem a little large; however it contains all Groovy JAR files.


(tested on v7.02 and v7.5)



All Replies

Posted by adaltas on 25-Jan-2008 11:44

Thank you! Your entry has been received and recorded and your rules copy moved.

This thread is closed