Node Event Handlers
This section describes the different types of node event handlers, their definitions, parameters, and examples.
Types of node event handlers
VAULT_INSERT
— This event handler is used to insert a record into a specific collection in the vault.VAULT_UPDATE
— This event handler is used to update a record in a specific collection in the vault based on the dynamic search criteria.MAPPER
— This event handler is used for data transformation, such as excluding, appending, or generating data in the execution chain.NEXT_EVENT_RECIPIENT
— This event handler is used to identify the recipient for the next event.EXPRESSION_LANGUAGE
— This event handler allows writing data manipulation expressions to easily access, filter, and calculate values.CUSTOM
— This event handler is used to specify a specific Java class that implements a legacy JAR (Java Archive) handler.
Handler definition constants
Handler data source (GenericHandlerDataSource
)
GenericHandlerDataSource
)EMPTY
— An empty source or collection.EVENT_PAYLOAD
— The payload source of events processed in the handlers chain.HANDLER_ARGUMENTS
— The response value from the previous handler in the chain.PERSISTED_ENTITY
— For vault-related handlers, it is the state of inserted or updated documents in a collection.
Dynamic handler value (DynamicHandlerValue
)
DynamicHandlerValue
)It uses "source" and "value" fields to link data. The actual value can be determined dynamically based on the information in the "source" field. Here are the possible values:
Source | Possible values | Description |
---|---|---|
| Any value | The constant propagates the value field as a result. |
|
| It generates a UUID or timestamp. |
|
| It gets the value of the original event sender, recipient, code, timestamp, or correlation ID. |
| Attribute name | It gets the value of the attribute in the event payload. |
| Attribute name | It gets the value of the attribute in the handler arguments. |
Handler definition examples
Vault Insert handler
Parameters | Data type / Values | Description |
---|---|---|
type |
| The handler type. |
order | Integer | The order of the handler in the execution chain. |
name | String | The name of the handler which is used for logging. |
collection | String | The name of the vault collection. |
collectionVersion | Integer | The version of the vault collection. |
dataSource |
| The data source of the record which will be inserted into the collection. |
handlerOutput |
| The handler output that will be passed as an argument to the next handler. |
Vault Update handler
Parameters | Data type / Values | Description |
---|---|---|
type |
| The handler type. |
order | Integer | The order of the handler in the execution chain. |
name | String | The name of the handler which is used for logging. |
collection | String | The name of the vault collection. |
collectionVersion | Integer | The version of the vault collection. |
dataSource |
| The data source from which the record changes (diffs) will be retrieved. |
handlerOutput |
| The handler output that will be passed as an argument to the next handler. |
insertIfAbsent | Boolean | It defines a flag that inserts the document if it does not exist in the collection based on the search criteria. The value is set to false by default. |
searchCriteria | Array of | The search criteria to find the document to be updated. |
Data Transformation handler
Parameters | Data type / Values | Description |
---|---|---|
type |
| The handler type. |
order | Integer | The order of the handler in the execution chain. |
name | String | The name of the handler which is used for logging. |
dataSource |
| The data source for the unmapped data. |
handlerOutput |
| The handler output that will be passed as an argument to the next handler. |
excludedAttributes | Array of strings | A set of attributes to be excluded from the input data. |
additionalAttributes | Map of (see Dynamic handler value) | A map of attributes with dynamic values calculated at runtime. |
Next Event Recipient handler
Parameters | Data type / Values | Description |
---|---|---|
type |
| The handler type. |
order | Integer | The order of the handler in the execution chain. |
name | String | The name of the handler which is used for logging. |
handlerOutput |
| The handler output that will be passed as an argument to the next handler. |
recipientAddress |
(see Dynamic handler value) | The dynamic value represents the recipient of the next event. |
Expression Language handler
The expression language used for this handler type is based on Spring Expression Language (SpEL). For more information, see the documentation for Spring Expression Language (SpEL).
Here are the operators supported in the language:
Type | Operators |
---|---|
Arithmetic | +, -, *, /, %, ^, div, mod |
Relational | <, >, ==, !=, <=, >=, lt, gt, eq, ne, le, ge |
Logical | and, or, not, &&, ||, ! |
Conditional | ?: |
Regex | matches |
Here are the parameters in the event handler definition:
Parameter | Data type / Values | Description |
---|---|---|
type |
| The handler type. |
order | Integer | The order of the handler in the execution chain. |
name | String | The name of the handler which is used for logging. |
dataSource |
| The data source of the record which will be inserted into the collection. |
computedAttributes | Map of expressions, where the key is a variable name, and the value is the expression itself. | The handler executes the expression and puts the value inside the specified variable. |
In Example 1, let's assume that the HANDLER_ARGUMENTS
has variables a
and b
. If the variables represent numeric values, such as a=1
and b=2
, then the result will be 1+2=3
. If the variables represent string values, such as a='1'
and b='2
', then the result will be '1'+'2'='12'
.
In Example 2, let's assume that the HANDLER_ARGUMENTS
has a variable user
, which represent a list with the following value:
The expression arguments[users].?[country=='USA'].size()
will filter the items which has the country value set to "USA"
. Then it calculates the size, which returns the count. In this case, the result will be 1
.
In Example 3, let's assume that the HANDLER_ARGUMENTS
has a variable user
, which represent a list with the following value:
The expression arguments[users].?[country=='USA'].size() > 0 ? 'USA_PRESENT' : 'USA_NOT_PRESENT'
will filter the items which has the country value set to "USA"
. Then it calculates the size, which returns the count. In this case, the count is 1
. If the count is greater than 0, then the result will be 'USA_PRESENT'
.
Custom (JAR) handler
Parameter | Data type / Values | Description |
---|---|---|
type | CUSTOM | The handler type. |
order | Integer | The order of the handler in the execution chain. |
jarUrl | String | The URL where the JAR file with the handler implementation is stored. |
className | String | The full Java class name that implements the corresponding interface. |
Last updated