switch script node
Routes incoming Message to one OR multiple output chains. Node executes configured JavaScript function.
JavaScript function receive 3 input parameters:
msg
- is a Message payload.metadata
- is a Message metadata.msgType
- is a Message type.
The script should return an array of next Relation names where Message should be routed. If returned array is empty - message will not be routed to any Node and discarded.
Message payload can be accessed via msg
variable. For example msg.temperature < 10;
Message metadata can be accessed via metadata
variable. For example metadata.customerName === 'John';
Message type can be accessed via msgType
variable. For example msgType === 'POST_TELEMETRY_REQUEST'
Full script example:
Last updated