Script Mapping
Groovy, a versatile programming and scripting language that runs on the Java Virtual Machine (JVM), was designed with a primary focus on providing enhanced flexibility and ease of use while preserving the robust and object-oriented capabilities of Java.
In MIP, Groovy serves as the scripting language. It offers simple and effective methods for reading and writing data. It has features that make it easier to work with JSON and XML data. This is useful in scenarios such as pulling data from web services or data mapping.
In the context of integration, to leverage Script, it is imperative to start by adding the Groovy document prepared in the "Resources" tab. Subsequently, this document is selected within the Script connector for effective integration.
import org.apache.camel.Exchange;
def Exchange executeMessage(Exchange message) {
// get input body
def body = message.getIn().getBody(String.class);
// set output message
message.getIn().setBody(output_message);
return message;
}