Switch Node

Route messages based on their property values or sequence position.

Details

When a message arrives, the node will evaluate each of the defined rules and forward the message to the corresponding outputs of any matching rules.

Optionally, the node can be set to stop evaluating rules once it finds one that matches.

The rules can be evaluated against an individual message property, a flow or global context property, environment variable or the result of a JSONata expression.

Rules

There are four types of rule:

  1. Value rules are evaluated against the configured property
  2. Sequence rules can be used on message sequences, such as those generated by the Split node
  3. A JSONata Expression can be provided that will be evaluated against the whole message and will match if the expression returns a true value.
  4. An Otherwise rule can be used to match if none of the preceding rules have matched.

Notes

The is true/false and is null rules perform strict comparisons against those types. They do not convert between types.

The is empty and is not empty rules can be used to test the length of Strings, Arrays and Buffers, or the number of properties an Object has. Neither rule will pass if the property being tested has a boolean, null or undefined value.

Note: Check out the match node to match messages based on property values.

Last updated on Oct 5, 2022

Newsletter

Subscribe to our newsletter to stay updated and to get notified once the platform officially launches:

By subscribing, you agree with Foretale’s Privacy Policy

© foretale - 2022