Splitter component

Overview

The splitter component can split incoming messages containing multiple elements that might have to be processed in different ways.

The component can also reassemble messages, each containing data related to one item, into a composite message.

Triggers

This component has no trigger functions. Therefore, this component cannot be used as the first one when designing an integration flow.

Actions

Split on JSONata expression

This component takes the incoming message body (which must be an array) and applies the configured JSONata transformation. This array is split and returned as multiple messages.

For example:

{
    "FirstName": "Fred",
    "Surname": "Smith",
    "Phone": [
        {
            "type": "home",
            "number": "0203 544 1234"
        },
        {
            "type": "office",
            "number": "01962 001234"
        },
        {
            "type": "mobile",
            "number": "077 7700 1234"
        }
    ]
}

The above message, along with the JSONata expression Phone.{type: number}, an object constructor, the action returns the output:

Split on JSONata expression
If the evaluated array contains primitive values like users:["John", "Mike", "Anna"], the splitter returns an error.

List of expected config fields

Split Property

Use this field to choose a separator.

Reassemble messages

The splitter can also reassemble split messages.

For instance, once a stream of incoming messages split by an action (or similar) has arrived, a single message of all message parts can be generated:

reassemble Messages
Unique ID to describe the group

This is a groupId. Globally unique ID for the group to distinguish it from other groups. This value needs to be the same for all messages in a group.

Unique ID to describe this message

This is a messageId ID for a message to distinguish it from other messages in the group. Must be unique per group but does not have to be globally unique. This value needs to be different for all messages in a group.

Number of messages produced by splitter

This is a groupSize. The number of messages in the group. This is required for the Produce groups of fixed size behavior.

Delay timer (in ms)

Period the process waits without incoming messages before emitting reassembled messages. The maximum is 40000 milliseconds.

Message data

Data from individual messages can be inserted here in the form of an object. This object is then inserted into an array which is available in the message emitted for this group.

List of expected config fields

Behavior

This field has three different behavior variants (options):

Behavior variants
Produce groups of fixed size (don’t emit partial groups)

A message is emitted once the group size is reached for the given group. If arriving messages for a particular group are less than the defined group size, then the group is not emitted.

Group all incoming messages

All incoming messages are gathered as long as specified in Delay timer. After this time has passed, messages are emitted for each group.

Produce groups of fixed size (emit partial groups)

Specify both groupSize and Delay timer. Once a group is complete, that group is emitted. Once there are no more incoming messages, then partially completed groups are also emitted.

Flow example

The following flow demonstrates a simple example of the reassemble action.

Example flow
  1. The Webhook component sends several messages.

  2. The messages are collected using a Splitter component. This step uses the Group all incoming messages behavior to wait 20 seconds (as specified in the Delay timer) for all messages.

  3. The messages are reassembled into one single array.

The array can be sent using the email component. An example message is:

Sample message
  1. Fill in the required fields as follows:

    Unique ID to describe the group

    group_id.

    Unique ID to describe this message

    message_id.

    Message Data

    message.

    Splitter reassemble
  2. Specify all the data in the email component.

    The array needs to be turned into a readable object. This is done with the $string() function:

    $string($getPassthrough()."step_6".body.messageData) (1)
    1 body.messageData is the output of the Splitter component.
    The email

The following email is received, which will contain the array we need: {"f1":"Gandalf the Grey",f2":"Frodo","f3":"Sam","f4":"Merry","f5":"Pippin","f6":"Aragorn","f7":"Boromir","f8":"Legolas","f9":"Gimli"}

Email message

Supported

  • Messages can be reordered in the flow.

  • If messages are redelivered as a result of the Connect’s 'at once' delivery guarantee, this action does not trigger false positives.

  • Split messages from one message can be interleaved with split messages from another message. For example, two overlapping webhook calls arrive, and the flow has components where parallel processing > 1.)

Limitations

  • All groups must have one or more messages (that is, no groups can have a size of 0). Regrouping is not possible when a split is done on an empty array (that is, no 'empty' for each pattern supported).

  • The group is dropped if there are any unexpected restarts to the container.

  • In case only a groupSize is given and no delay timer is specified. The size of the group must be known by all group members.

  • Messages are only returned when all of their parts have arrived. A message is not returned when only the first part of it arrives.

  • The delay timer can not exceed 40000 milliseconds. If more than this maximum is given, then this maximum is used instead.