Parallel and Wait
The Parallel block allows you to run sets of API blocks at the same time. This is a powerful block that unlocks the ability to parallelize work in your APIs.
There are 2 types of Parallel blocks:
A Static Parallel block is useful when you need to run a specific number of paths simultaneously, each with their own set of blocks. The number of paths for this type of parallel does not change dynamically. You can also rename paths for readability, similar to how you can rename blocks.
Static Parallel output
Access the output of the Static Parallel block by referencing its output property (e.g.,
Parallel1.output). The output of a Static Parallel block is an object with a key for each path name, whose value is the output of the last step in that path. For example:
A Dynamic Parallel block is a very powerful block type. It will run all the child blocks for every item in the List of items field, similar to a For Each Loop block. However, unlike the Loop block, the Dynamic Parallel block will run the child blocks at the same time for every item in the list, just like parallelized code.
Access the current path's item inside any of the child blocks using the
item.value variable. Note, this variable can be renamed in the Parallel block edit pane.
Dynamic Parallel output
Access the output of the Dynamic Parallel block by referencing its output property (e.g.,
Parallel1.output). The output of a Dynamic Parallel block is an array with an item for every iteration path of the parallel, whose value is equal to the output from the last child block in each path. For example:
Dynamic Parallel variables
item is the default variable name.
Waiting configuration in Parallel blocks
Under Wait for, control whether the API should wait for all paths to complete (default) or if the API should continue without waiting.
Note, changing this to wait for none of the paths means the output of the Parallel block is not guaranteed when used in downstream blocks. In this case, use the Wait block to wait for the paths of a Parallel block to complete at a later point in the API.
The Wait block allows you to wait for an upstream Parallel block’s paths to complete.
Define the Parallel block to wait on in the Wait for parallel block field in the Wait block edit pane. When the Wait block runs, the API will wait until all paths from that Parallel block have finished, if they haven't already. The Parallel block's output is now guaranteed beyond this point, so all blocks after the Wait block can reference the Parallel block's output with confidence.
The Wait block has no output.