Object registeredScript = message.getMuleContext().getRegistry().lookupObject(flowName);
Preconditions.checkNotNull(registeredScript, "The script called " + flowName + " could not be found");
if (registeredScript instanceof Scriptable)
{
Scriptable script = (Scriptable) registeredScript;
Bindings bindings = script.getScriptEngine().createBindings();
script.populateDefaultBindings(bindings);
try
{
return script.runScript(bindings);
}
catch (ScriptException e)
{
throw new RuntimeException("Your script has an execution error ", e);
}