# Routing Nodes

# Batch

Batching process is a common scenario in integration were the target system might require data in a smaller chunks. In such cases the payload in hand should be sliced into batches of smaller sizes which an external system can accept. A Batch node creates new sequences of messages from those received payload.

The node provides three modes of operation.

Sequence by Number of Messages:

Groups messages into sequences of a given length. The overlap option specifies how many messages at the end of one sequence should be repeated at the start of the next sequence.

Sequence by Time interval:

Groups messages that arrive within the specified interval. If no messages arrive within the interval, the node can optionally send on an empty message.

Sequence by Concatenation:

Creates a message sequence by concatenating incoming sequences. Each sequence must have a msg.topic property to identify it. The node is configured with a list of topic values to identify the order sequences are concatenated.

TIP

Batch nodes are always used in conjunction with join Node.

Example :

How to use a batch node

How to use a batch node with group by time interval mode

How to use batch node in concatenate sequence mode

Link node is a virtual wire representing the input or output for a flow. The node can be used to represent as any component or element which are not valid during runtime but provides understanding on a documentation perspective.

Link has input and output node. Link In node represents the input for a flow and Link Out node represents the output for a flow.

TIP

No Objects are accessible through this node. The node will propagate message, variables to the next node.

Example: How to use a Link node.

# Processor

Processor nodes brings easy to use loops and OOP (object oriented programming) features to the flow programming paradigm. Three nodes allow you to create extensible, scoped, looped, and prioritized flows. Utilities include performance benchmarks with nanosecond precision. You can organize flows for readability and create extendable design patterns.

ActionFlows provide additional key functionality (described later in this document):

  • Late binding - extend complex flows without modifying the original flow
  • Looping - call flow segments repeatedly with conditional iteration
  • Create OOP-like "classes" (subflows) with public/private flows
  • Prioritize flows - allow for OOP-like overrides & inheritance
  • Flow scopes - private, protected, and global flows

The action node works like a subflow, allowing you to define a reusable flow segment between the nodes action in and action out.

Unlike the links node, the action node invokes the action in node by a prefix naming schema; allowing for multiple add-on flow segments to be appended to the original flow. An action node's name determines the name of the corresponding action in node that will be activated. Use the action node's name as a prefix for all subsequent action in nodes that you wish to be callable by the action node. For instance, an action node named "Sample", will call any action in nodes with names like "Sample in", "Sample-in", "Sample_Exercise", or "sample.acme.com".

Example:

How to use a Processor node

# Sort

Sort node can be used to sort the sequence based on a property value or JSONata expression result.

Example:

How to use sort node using specific key

# Split

Split node splits the message into a single message into a sequence of messages. The exact behavior of the node depends on the type of msg.payload.

If the message type is String\Buffer then the message is split using the specified character (default: \n), buffer sequence or into fixed lengths.

If the message type is an Array then the message is split into either individual array elements, or arrays of a fixed-length.

If the message type is an Object then the message is split and sent for each key/value pair of the object.

Example:

How to use a Split node

How to use Split node using the String\Buffer option

How to use Split node using fixed length option

How to use Split node using Object key value pair

# Join

Join node turns a sequence of messages into a single message. The node provides three modes of operation.

Automatic

This mode attempts to reverse the action of a previous split node.

Manual

This mode allows finer control on how the incoming message sequence should be joined.

Reduce

This mode allows a JSONata expression to be run against each message in the sequence and the result accumulated to produce a single message.

Example:

How to use join node in manual mode option

How to use join node in reduced sequence mode option

# Switch

The Switch node allows messages to be routed to different branches of a flow by evaluating a set of rules against each message.

The node will route the message to the first matching rule.

# Fields

  • Property: Rules are evaluated against the value of this field. It supports dynamic expressions.

  • Rules: Dynamic list of rules to compare against the property.

# Rule Conditions

  • equals: true iff property === value
  • not equals: true iff property !== value
  • less than: true iff property < value
  • at most: true iff property <= value
  • greater than: true iff property > value
  • at least: true iff property >= value
  • is between: true iff property >= value1 && property <= value2
  • contains: true iff _property contains substring value
  • regex: true iff _property matches the regular expression value
  • is true: true iff property is TRUE
  • is false: true iff property is FALSE
  • is nil: true iff property is null or undefined
  • is not nil: true iff property is not null nor undefined
  • is of type: true iff property is of the type value
  • is empty: true iff strings, arrays or buffers are of length 0, or if object is not null and it does not have any keys.
  • is not empty: true iff strings, arrays or buffers are of length more than 0, or if object is not null and it has at least one key.
  • otherwise: true if rest of rules were evaluated to false.

WARNING

The otherwise rule is optional, but if present ensure that it is placed at the end of the list of rules.

# Examples

How to use a Switch node.