KBEC-00260 - How to run two states in parallel in a workflow (using the Broker)

Problem

A workflow needs to run two states in parallel, but it's not clear how to create this in Flow.

Solution

Through the use of a "Broker," parallel states can be run in Flow.
However, while these states are run at the same time, only one state can have an exit path.

parallel-workflow-1.png

As illustrated in the above workflow, a Broker state passes the workflow control to State1, then immediately returns to the Broker, which then sends the control of the workflow to State2.

The key to the control of these states and transitions lies mainly in the definition of the transitions as described below.

First Transition out of Broker

The first transition out of the broker is an On Completion transition with the Condition set to Always. This will cause the transition to trigger the first time the workflow enters the Broker.

Note that it does not take the "start state2" transition because the condition is not met, which will be discussed in a later step.

parallel-workflow-2.png

Return Transition to Broker

The return transition to the Broker is an "On Start" transition, to ensure that it will not wait for State1 to complete but rather transition immediately.

parallel-workflow-3.png

Second Transition out of Broker

The second transition out of the Broker has a condition set, in this case that the "count" is two, meaning that it has entered the Broker a second time. parallel-workflow-4.png

This can be used to run any number of states in parallel. Here it is running 5 states in parallel:

parallel-workflow-5.png

Have more questions? Submit a request

Comments

Powered by Zendesk