Using the Run Flow Async and Wait Property
  • Updated on 31 Jul 2015
  • 3 minutes to read
  • Print
  • Dark
    Light

Using the Run Flow Async and Wait Property

  • Print
  • Dark
    Light

This tutorial demonstrates how to use Run Flow Async And Wait configuration for the Sub-Flow steps. Run Flow Async And Wait is an advanced configuration and should be used with caution. It is important to understand in what cases this feature should be used. When this setting is on, Sub-Flow step will run Async (like Fire and Forget) but Parent Flow will wait on the results. For example, this can be used if Parent Flow has to make several expensive Web Service calls.

Example:
In this example we are going to create a Flow with two Sub-Flows. Each of theSub-Flows will make Web Service calls. We are going to compare Flow execution times with and without Run Flow Async And Wait setting.
First, we need to add couple Web Service References. Navigate to the System > Integrations > External Services folder and click Add WebService Reference on the Folder Actions Panel.

2018-01-02_115327.png

In the resulting window we Name WebService Reference , provide URL and specify WSDL . Click Ok to save and close this pop-up window.

2018-01-02_115513.png

Next, we add another WebService Reference in the similar manner.

2018-01-02_115817.png

System creates WebService References in the External Services Folder.

2018-01-02_115857.png

Next, we navigate to the Designer Folder and click Create Flow on the Folder Actions Panel.

2018-01-02_120002.png

In the resulting window we Name the Flow and click Create to proceed to the Flow Designer.

2018-01-02_120113.png

In the Flow Designer we add Forloop step from the All Steps [Catalog] > Flow Management category.

2018-01-02_120217-1024x767.png

Then, we select Forloop step on the workspace and configure No of Iterations value to Constant ‘50’.

2018-01-02_120309.png

On the Next outcome from the Forloop step we add GetCountries step from the Integrations > My Integrations > WebServices > Countries category.

2018-01-02_120427-1024x767.png

Then, we connect steps in our Flow as following. This completes our Flow . We can save and close Flow Designer.

2018-01-02_120650.png

Back in the Designer Folder we Create another Flow .
2018-01-02_120728.png

Name the Flow and click Create to continue.

2018-01-02_120904.png

This Flow is going to be designed similar to the First Flow that we created in this tutorial. We add Forloop step from the All Steps [Catalog] > Flow Management category.

2018-01-02_121006.png

Then, we configure this Forloop step to Iterate 50 times.

2017-01-31_133031.png

On the Next outcome from the Forloop step we add GetQuote step from theIntegrations > My Integrations > Web Services > StockQuote category.

2018-01-02_122153-1024x768.png

Next, connect steps in the Flow as on the following figure. Then, we define Constant symbol Input for the GetStock step. This completes our Flow . We save and close Flow Designer.

2018-01-02_122446.png

Finally, back in the Designer Folder we click Create Flow to build Main Flow.
2018-01-02_122539.png

Name the Flow and click Create .

2018-01-02_122645.png

In the Flow Designer we add [Pick or Create Flow] step from the Flows, Rules, Forms and Reports > Flows category.

2018-01-02_122724-1024x798.png

Then, in the resulting pop-up window we Pick Get Countries Flow.

2018-01-02_122839.png

We add another [Pick or Create Flow] step…
And pick Get Stock Quote Flow that we have created previously in this tutorial.

2018-01-02_122957.png

Connect the steps in the Flow and click Debug Flow on the top panel of the Flow Designer to test the Flow .

2018-01-02_123104.png

Debugger indicates that execution time was 37 seconds.

2018-01-02_123255.png

Back in the Flow Designer we select Get Countries Sub-Flow on the workspace and enable Run Flow Async And Wait configuration.

2018-01-02_123345.png

Then, we do the same for the Get Stock Quote Sub-Flow.
Click Debug Flow link to test Flow execution with new settings.

2018-01-02_1231041.png

This time Debugger indicates that our Flow execution took 31 seconds. In the second case Sub-Flows ran on the different threads.

2018-01-02_123524.png

Was this article helpful?