Flow and Subflow

Introduction

A sub-flow is a reusable sequence of activities that can be used across multiple flows. By incorporating sub-flows into your workflows, you can streamline processes and enhance consistency. Think of a sub-flow as a modular component that can be included in various flows, similar to how programming macros or inline code work.

How does it work?

Like any other activity or tool, a sub-flow can be included in your flows. You can connect subflows to other nodes in the same way as you would with regular activities.

Benefits of Using Subflows:

  • Reusability and Reduced Development Time: Subflows allow you to use the same sequence of activities in multiple flows, saving time and effort.
  • Consistency and increased maintainability of similar flows: They help maintain consistency across similar flows and make it easier to manage updates.
  • Flexibility: You can tailor subflows for specific contexts, such as updating output queues or data sources.
  • Asynchronous Processing: Asynchronous subflows can handle time-consuming tasks (like database updates or sending emails) without halting the main flow.

Types of subflow

To explore the different types of subflows, let's start with an overview of synchronous and asynchronous subflows, followed by examples that demonstrate their application.

Synchronous

A sub-flow runs synchronously (relative to the flow that triggered its execution) and always inherits both the processing and exception strategies employed by the triggering flow. While a subflow is running, processing on the triggering flow pauses, then resumes only after the subflow completes its processing and hands the message back to the triggering flow.

  • Case 1: Standard synchronous subflow
  • Case 2: Using Subflow multiple times in a flow.
  • Case 3: Same sub-flow used by multiple flows

Asynchronous

An asynchronous flow runs simultaneously and asynchronously parallel to the flow that triggered its execution. When a flow triggers an asynchronous flow, thus triggering its execution, it simultaneously flows to the next activity processor in its flow. Thus, the two flows—triggering and triggered—execute simultaneously and independently, each finishing independently. This flow type does not inherit processing or exception strategies from the triggering flow.

  • Case 1: Standard asynchronous subflow.


  • Case 2: Same sub-flow used by multiple flows.
Created by Julieth Last modified by Aadrian on Dec 13, 2024