Scripting Module Reference | MuleSoft Documentation
# Scripting Module Reference
Scripting Module v2.1
The Scripting module executes custom logic written in a scripting language.
## Configurations
### Config
Default configuration
#### Parameters
Name | Type | Description | Default Value | Required  
---|---|---|---|---  
The name for this configuration. Connectors reference the configuration with this name.  
## Operations
### Execute
`<scripting:execute>`
Run a script with provided code, according to the engine and passing parameters. The script provides many binding variables to work with:
Name | Type | Description  
---|---|---  
The payload of the message processed.  
dataType | Data type of the message payload.  
correlationId | The correlationId of the message processed.  
attributes | Map<String, Object> | Attributes of the Mule message processed.  
Map<String, Object> | The variables set on the current Mule event processed.  
The message processed.  
Error associated with the Mule message processed.  
authentication | Information about the authentication.  
The name of the current flow.  
Logger object that logs to the app’s log file, `MULE_HOME/logs/<app-name>.log`  
Variable representing the result of the script execution.  
registry | org.mule.runtime.api.artifact.Registry | Use the registry object to access any other service within the Mule API.  
If the code doesn’t produce an implicit result, you have to set the `result` variable value explicitly with the execution result. The payload is set with this value unless you configure a target variable as described in Scripting Module Overview.   
---  
#### Parameters
Name | Type | Description | Default Value | Required  
---|---|---|---|---  
The script source code to execute  
Name of the scripting engine for running this script  
Parameters |  Map<String, Object> | Variables provided to the script as bindings  
Execution Mode |  Enumeration, one of:
  * INTERPRETED

| Determines whether the script is automatically compiled or forced to be interpreted. When set to `AUTO` or not specified, the module analyzes the context to determine the appropriate mode. When set to `INTERPRETED`, the module enforces interpretation mode.  
Target Variable | The name of a variable on which to place the operation’s output  
Target Value | An expression to evaluate against the operation’s output. The outcome of that expression will be stored in the target variable. | #[payload]  
You must export the classes used with the Scripting Module, otherwise, the execution fails with a `SCRIPTING:COMPILATION` error. See how to export resources.   
---  
#### Throws
  * SCRIPTING:COMPILATION
  * SCRIPTING:UNKNOWN_ENGINE
  * SCRIPTING:EXECUTION


## Types
### Aggregation Attributes
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Aggregation Id | Aggregation ID that comes from the event’s message correlationId. If the aggregator does not aggregate by correlationId, then this field is an autogenerated value for the current aggregated group.  
First Item Arrival Time | Time in which the first aggregated value arrived.  
Last Item Arrival Time | Time in which the last aggregated element arrived.  
Is Aggregation Complete | A boolean value that indicates the completion of the aggregation.  
### Redelivery Policy
Configures the redelivery policy for executing requests that generate errors. You can add a redelivery policy to any source in a flow.
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Max Redelivery Count | Maximum number of times that a redelivered request can be processed unsuccessfully before returning a REDELIVERY_EXHAUSTED error.  
Use Secure Hash | If `true`, Mule uses a secure hash algorithm to identify a redelivered message.  
Message Digest Algorithm | Secure hashing algorithm to use if the <b>Use Secure Hash<b/> field is `true`. If the payload of the message is a Java object, Mule ignores this value and returns the value that the payload’s `hashCode()` returned.  
Id Expression | One or more expressions that determine when a message was redelivered. This property can be set only if the <b>Use Secure Hash</b> field is `false`.  
Object Store |  ObjectStore | Configures the object store that stores the redelivery counter for each message.  
## See Also
  * Scripting Module Release Notes
  * MuleSoft Help Center