Join
Node Documentation
Joins sequences of messages into a single message.
There are three modes available:
- automatic
- When paired with the split node, it will automatically join the messages to reverse the split that was performed.
- manual
- Join sequences of messages in a variety of ways.
- reduce sequence
- Apply an expression against all messages in a sequence to reduce it to a single message.
Inputs
Details
Automatic mode
Automatic mode uses the parts
property of incoming messages to determine how the sequence should be joined. This allows it to automatically reverse the action of a split node.
Manual mode
When configured to join in manual mode, the node is able to join sequences of messages into a number of different results:
- a string or buffer - created by joining the selected property of each message with the specified join characters or buffer.
- an array - created by adding each selected property, or entire message, to the output array.
- a key/value object - created by using a property of each message to determine the key under which the required value is stored.
- a merged object - created by merging the property of each message under a single object.
The other properties of the output message are taken from the last message received before the result is sent.
A count can be set for how many messages should be received before generating the output message. For object outputs, once this count has been reached, the node can be configured to send a message for each subsequent message received.
A timeout can be set to trigger sending the new message using whatever has been received so far. This timeout can be restarted by sending a message with the msg.restartTimeout
property set.
If a message is received with the msg.complete
property set, the output message is finalised and sent. This resets any part counts.
If a message is received with the msg.reset
property set, the partly complete message is deleted and not sent. This resets any part counts.
Reduce Sequence mode
When configured to join in reduce mode, an expression is applied to each message in a sequence and the result accumulated to produce a single message.
Example: the following settings, given a sequence of numeric values, calculates the average value:
- Reduce expression:
$A+payload
- Initial value:
0
- Fix-up expression:
$A/$N
Storing messages
This node will buffer messages internally in order to work across sequences. The runtime setting nodeMessageBufferMaxLength
can be used to limit how many messages nodes will buffer.