Running Steps Asynchronously with the Go Async Component
  • 18 May 2021
  • 3 Minutes to read
  • Dark
    Light

Running Steps Asynchronously with the Go Async Component

  • Dark
    Light

Article Summary

Overview

The Go Async component allows subsequent Flow steps to run asynchronously on a different thread, returning control immediately to the Flow's calling entity (such as a Parent Flow, user, or rocess). In other words, any steps placed after the Go Async component will run autonomously. This allows a user to be more granular in their choice of what is ran asynchronously. Go Async allows the user to define which points run Async, rather than running an entire Async sub Flow. 

This can be useful for managing steps that are expected to take a long time and produce Outputs that aren't required by the calling entity. 

Note that any Outputs produced by steps subsequent to the Go Async component will not be available to the calling entity since that entity will cease to have any insight into what they are doing.

Another useful application of this component is error handling. If a non-critical error is thrown within a Flow, (for example, sending a non-critical email), the Flow could initiate an error handling process using the 'Go Async' component and then resume with the main process.

The Go Async component can be found in the Toolbox panel, under the category Flow Management.










Example

Note
Download and import the following project file to begin building out the example.

The example Flow utilizes a list of new subscriber email addresses to send a welcome email to each one of those subscribers. Because the process of sending many emails will not return a necessary Output, and because the process itself could take a very long time, the process will run autonomously with the Go Async component.

This example Flow has already been started with some functional components already in place. 

  1. Continue building by going to the Designer Project, right-clicking the Send EmailList Flow, and then clicking the Edit Flow option.

  2. In the Flow Designer, notice that the steps already in place are Email Addresses List (which provides the list of subscriber email addresses) and Send Email 1 (which will send welcome emails to those addresses).
    Select the Email Addresses List step and from its Properties tab, Constant map in a list of Email addresses, being sure to give each address its own separate line.

    Note that for this example it is recommended to use temporary emails; this allows the ability to test multiple emails without having to send it to multiple recipients' inboxes. 

  3. After the Flow compiles the list of email addresses, autonomously sending the welcome emails will immediately return control to the entity that called it. In this case, returning control to the entity is equivalent to immediately progressing to the End Step while Send Email 1 continues to send emails.
    To do so, add in a Go Async component from the Toolbox tab's FlOW MANAGEMENT category. 

  4. Connect the Done path of the Email Addresses List step to the Go Async step. 

  5. Connect the Done path of the Go Async step to the Send Email step. 

    Flow Behavior and Steps
    Be mindful of placing any steps that may potentially alter a Flow's Behavior or place the Flow in an unexpected State, after the Go Async step, as these may prevent the Flow from performing the rest of the process asynchronously.

    For example, utilizing a Pause Flow step will halt the Flow until the defined time and subsequently place the Flow in a Stored Workflow State; this could potentially affect how the rest of the Flow operates.

  6. Save the Flow, then close via if desired.



Debug

  1. Click the Debug link from the toolbar from the top of the screen.

  2. Click the START DEBUGGING button.
    The example Flow progresses smoothly to Send Email 1 a step that ordinarily would take several minutes but, in this case, continues asynchronously while the Flow continues uninterrupted to the End Step.

  3. Navigate to the Execution Dashboard by selecting the Send EmailList Flow [Capture All], and then clicking the Execution Dashboard tab; the Number of Flows displayed should reflect the number of processes or email addresses that were used as Inputs for the Email Addresses List step. 










Was this article helpful?