- 18 May 2021
- 3 Minutes to read
- Print
- DarkLight
Running Steps Asynchronously with the Go Async Component
- Updated on 18 May 2021
- 3 Minutes to read
- Print
- DarkLight
Overview
The Go Async component allows subsequent flow steps to be ran asynchronously on a different thread, returning control immediately to the flow's calling entity (such as a parent flow, user, or process). 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 are ran 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 in error handling. If a non-critical error is thrown within a flow, (for example, in 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
This example flow utilizes a list of over 1,000 new subscriber email addresses to send a welcome email to each one of those subscribers. Because the process of sending 1,000 emails will not return a necessary output, and because the process itself could take a very long time, the process will be ran autonomously with the Go Async component.
This example flow has already been started with some functional components already in place. Continue building by going to the Designer Folder and clicking the Edit link on the Send EmailList Flow thumbnail.
In the Flow Designer, notice that the steps already in place are Email Address List (which provides the list of subscriber email addresses) and Send Email 1 (which will send welcome emails to those addresses). Both steps are configured and ready to go, except for the fact that they are unconnected.
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 this, place the Go Async component in the flow between Email Address List and Send Email 1. It is in the Steps panel, under the category Flow Management.
Next, connect Email Address List to Go Async 1, and Go Async 1 to Send Email 1 with their respective Done outcomes.
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.
Debug
To debug it, click the Debug Flow link at the top of the Flow Designer.
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.