Skip to content

Control Flow

Control flow steps allow you to implement complex logic, branching, iteration, and error handling within your Flow Services. While a simple flow executes steps one by one, these advanced steps enable non-linear execution.

Available Step Types

Joynare Nexus provides eight specialized processing steps:

INVOKE

The primary step for calling services (Built-in, Flow, or Adapter).

  • Key Features: Mixed Mode mapping (Auto, Explicit, Literal), input/output schemas.

MAP

Directly manipulates pipeline variables. Use it to set literal values, copy variables, or drop unnecessary data.

  • Key Features: Literal assignment, variable referencing, pipeline cleanup.

BRANCH

Implements conditional logic (if/else or switch/case).

  • Key Features: Switch mode (exact match) and Expression mode (conditional operators).

SEQUENCE

Groups steps and defines error handling strategies.

  • Key Features: Try/Catch/Finally patterns, scoped exit strategies (exitOn).

LOOP

Iterates over arrays in the pipeline.

  • Key Features: Item scoping, automatic index management, loop cleanup.

REPEAT

Repeats steps based on a count or a success/failure condition.

  • Key Features: Retry logic, polling, configurable intervals.

TRY-CATCH

A dedicated step for robust error recovery. It executes a block of steps and, if any fail, automatically runs a separate 'catch' block.

  • Key Features: Error suppression, automatic _error injection, recovery logic.

EXIT

Signals an early termination from a flow, loop, or sequence.

  • Key Features: Conditional exits, success/failure signaling, scoped breaking.

Reliability Features

In addition to dedicated step types, any step in Joynare Nexus can be configured with reliability policies.

Step-Level Timeouts

You can enforce a maximum execution time for any step. If the step exceeds the timeout, it fails immediately.

yaml
- type: "invoke"
  service: "system.http:Get"
  timeout: 5000 # Time in milliseconds

Explicit Retry Policy

You can add a retry policy with exponential backoff to any step. This is ideal for handling transient network issues.

yaml
- type: "invoke"
  service: "ExternalService"
  retry:
    count: 3
    initialInterval: 500 # Wait 0.5s after first failure
    backoffRate: 2.0     # Double the wait time on each attempt

Which Step to Use?

  • Need to rename a field? Use MAP.
  • Need to check if a user is active? Use BRANCH.
  • Need to handle a service failure gracefully? Use TRY-CATCH.
  • Need to process a list of orders? Use LOOP.
  • Need to retry an unstable API? Use REPEAT or a retry policy.
  • Need to stop a flow early? Use EXIT.

Released under the ISC License.