Skip to content
Austin Brougher edited this page Jan 31, 2019 · 18 revisions
Script

Icon

metl script 48x48 color

Use When

A custom action should be performed that can be written using Groovy

Samples

See Script Templates

Description

The script component executes one or more configurable groovy scripts. Groovy scripts can be configured to run at different points in the component lifecycle including Component Initialization (onInit), Inbound message arrival (onHandleMessage), Successful flow completion (onSuccess), and Flow completion with error (onError). The different run points are implemented as methods in Script Helper. All methods and fields in ScriptHelper are available for use in your script.

There are several Templates that can be referenced or used as a starting point to building your script.

Inbound Message Type

Any Message Type

Output Message Type

Any Message Type

Control Message Handling

Input: This component handles control messages based on what is defined in the various script methods.

Output: Output messages will be determined by the logic in this component.

Properties
Name Description

Resource

A resource that can be accessed and utilized by the script.

Input Model

Output Model

Error Suspense Step

Whether to forward failed messages and continue processing. This is the name of a linked component to forward the failed messages to.

Enabled

Import Statements

Import statements for external dependencies

Methods

Helper methods to be used by the script process

Init Script

The script to be executed upon component initialization

Handle Msg Script

The script to be executed upon receipt of an inbound message

Ended with Success Script

The script to be executed upon successful completion of the flow

Ended with Error Script

The script to be executed upon a failed completion of the flow. Note: this will not be called if a flow uses an Assert component to capture an error. This only triggers on regular flow errors.

Log Input

Log Output

Inbound Queue Capacity

Tip
The component object can be used to access the components runtime information. This can be used to access the flow parameters. Example: String store = component.resolveFlowParams('$(store)');
Example 1. Send Text Message
info("Send a text message");
String body = "My Text Message Body";
callback.sendTextMessage(null, body);
Clone this wiki locally