SCRIPT mode of MAPPER needs the optional script-js module (see Built-in plugins).
Options marked “expression” take the expression language described in Variables and expressions. Inside an expression the message is the root, so payload.price reads a payload field. These plugins do not resolve ${...} variables in their options. Unless a section says otherwise, the default timeout is the engine default of 30 seconds idle.
MAPPER
Rebuilds the payload of each message. It has three modes.
Output port:
default. The message keeps its id and metadata; only the payload changes.
A template uses double-brace placeholders such as
hi {{payload.name}}. A payload that is not an object is wrapped as {"value": <payload>} when dropOriginal is false in PROJECTION mode.
With strictMode off, a projection field whose expression gives null is left out, and a failing script gives an empty payload (or the original payload when dropOriginal is false). With strictMode on, a null result is written as null and any evaluation error fails the message.
SCRIPT mode
A script sees three values:message, payload and metadata. Its result is the value of its last expression, converted to plain objects, lists and scalars. An object literal needs parentheses:
The run-time and statement limits are server start-up settings,
yukta.script.timeout-ms (10000) and yukta.script.max-statements (50000000).
A SCRIPT node is rejected at validation when the script-js module is not in the build. Prefer PROJECTION for simple reshaping: it is faster and cannot reach anything outside the message.
{"id": 1, "name": "Ada", "active": true} this node emits {"userId": 1, "label": "user:Ada"}.
This node writes a text payload from a template:
VALIDATE
Checks required fields and field types on the payload and routes bad messages to theinvalid port, so bad input can be set aside instead of failing a later node.
At least one of
required and types must be set. A field listed in types that is absent or null passes the type check; list it in required as well to insist on it.
Output ports: default for valid messages and invalid for the rest. An invalid message carries every reason found, such as missing field: email; field qty is not number, as its failure reason. A payload that is not an object is invalid with the reason payload is not an object.
CONTENT-FILTER
Keeps or removes parts of a message. Use it to strip sensitive or unimportant fields before logging or sending a payload on. The type string is written with a hyphen.
Output ports:
default, plus errorPort when set.
Paths:
- A plain path such as
user.namerefers to the payload. - A path starting with
metadata.orheaders.refers to the message metadata. - In
INCLUDEmode a path may also be an expression. A path that starts with#is evaluated as one. - In
EXCLUDEmode paths are plain dotted names. Missing paths are ignored.
INCLUDE, the new payload holds only the listed paths, nested as written. When any listed path targets metadata, the metadata is replaced by the listed entries plus the message’s core identifiers (message id, trace id, correlation id, timestamp, sequence fields and reply address).
If the payload is a list, each item is filtered on its own and emitted as a separate message.
This node removes secrets before a payload goes on: