About Sync and Async Sub-Flows
  • 17 Dec 2021
  • 4 Minutes to read
  • Dark
  This documentation version is deprecated, please click here for the latest version.

About Sync and Async Sub-Flows

  • Dark


A Sub-Flow is a Flow that runs like a Step within the course of another Flow. A Sub-Flow may also be referred to as a "Child Flow" and the primary Flow as a "Parent Flow."

A Sub-Flow may be set to run in one of two ways:

  1. The Sync method: allows the Sub-Flow and Main Flow to run sequentially .

  2. The Async method: allows the the primary Flow to run independently, while the Sub-Flow completes.

Each method has benefits for use in different scenarios; part of Flow design planning should be to decide which method works for a specific scenario. The key difference is that the Sync method allows the Flows to run in sequence. The Async method is designed to allow the Sub Flow to run independently of the Parent Flow. With Async, control is immediately given back to the primary Flow. The consequence of this method is that the relationship between the two Flows is "asynchronous", meaning that the Sub Flow is now an independently executing Flow and has no necessary output data to deliver to the primary Flow. Included below are a few examples and further information, regarding the different types of sub flows.

Async Flows

Start Linked Flow Async

In the screenshot below, the gray-colored Process Flow is a Linked Flow Async step. In this example, the Sub Flow is designed to run independently from the Primary Flow. The primary purpose of Async Flows is for use in instances where the Primary Flow needs to delegate a task to the Sub Flow. 

In this example, whenever an email is found, it is delegated to the Process workflow to be filtered by a user set rule. In this case, the Async method allows the Primary Flow to check for Emails, while the Child Flow, processes each one individually.

Async Flows run as a System user and not the initiating user. 
Used Frequently
Please note there are multiple ways to run a process asynchronously, but the Start Linked Flow Async is the most used step by Decisions developers to achieve this.

The table below represents each of the available Properties provided by the Start Linked Flow Async step: 

OptionFunction Description
Selection TypeDecisions can run a Flow picked by a user or can be dynamically selected at runtime.
Use Work QueueFlow execution can be passed onto a work queue to be handled e.g. Rabbitmq. Enables WorkQueueName selector.
WorkQueueNameAllows the user to select the desired Work Queue. 
Manage Execution ThreadsThe user can select which and how many threads to run the process on.
ThreadCountThe number used to dictate the number of Execution Threads. 
ThreadJobNameUsed to dictate the name of the Thread Job. 

Viewing Thread Jobs from Start Linked Flow Async 

To view the Thread Jobs from a Start Linked Flow Async Subflow:

  1. From the Decisions Studio, navigate to System > Administration > System Tools.
  2. Open the Event Viewer.
  3. Navigate to the THREAD JOBS tab. 
  4. Scroll to the bottom of the end of the Active Thread Jobs to view the Thread Jobs for the Subflow

Start Linked Flow Async Flows in Multi-Node Environments

When utilizing a multi-node environment, Thread Jobs are not shared across the Server Cluster. Instead, they are completely discrete; this means that an Async Job that is started on one Server will stay on and be executed on that one specific Server. The information from these Jobs is not shared across Servers in any sort of way. The load balance directs the work so that each Server has its own specific Queue and Thread Jobs.

Run Flow Async And Wait

The Run Flow Async And Wait is a check box configuration on the Run Flow step.  This configuration does not run the sub Flow independent from the parent process but executes it on a separate thread.  This check box configuration does three things: spawns a new process, runs the Flow on a separate thread, and returns the data to the main Flow. This is helpful in scenarios that involve multiple steps that may involve a loop or branch that would usually run synchronously, such as API calls or adding numbers. Run Flow Async and Wait allows these tasks to be executed in parallel to save time.  

One difference between the Run Flow Async and Wait step and the Start Linked Flow Async is, the Run Flow Async and Wait returns data while the Start Linked Flow Async does not return data. Run Flow Async and Wait is most commonly used to assist API calls that return large amounts of data. 

Go Async Flow Step

Go Async step's purpose is to move the current execution of the Flow to a different thread. This allows users more fine tuning when it comes to directing which portion of a Flow is ran Async. Users may run portions of a Flow as Async without having to move the whole process. For more information review Running Steps Asynchronously With The Go Async Component.

Synchronous Flows

Sync Flows are helpful for handling processes that require the main Flow and Sub Flow to occur one after the other. For instance, within the Async Flow above, the Email handling process is split up into multiple synchronous Sub Flows depending on how the Email is evaluated. In the example below, after reaching the Email Process Folder, an Email is evaluated as either an invoice, resume, or other type, and sent to its respective Sub Flow. This allows for the ability to run a Sub Flow midway through the process, before proceeding to the next step and returning data to the parent Flow. This can be especially helpful if manager approval, or a user response is required in the process. It also allows each sequence in the Flow to be evaluated and easily troubleshooted, as they are split up separately. 

Checking Flow Attribute 

In order to determine if a Flow is Sync or Async after it has been created without opening it, users may utilize the information provided by the Element Attribute in the Flow's Properties. This Property provides information on the selected Designer Element such as its Type, and its run behavior.
This information is located in the Information Panel that appears upon selecting any space within the Designer Project's Report row for that specific Flow. 

Was this article helpful?