A gateway is used to control the flow of execution. A gateway can be exclusive, inclusive or parallel.
It is used to model a decision on the process. An exclusive gateway is displayed as a gateway with an “X” icon inside.
When the execution reaches this gateway, the system will choose the first sequence flow which condition evaluates to true (or which does not have a condition set) for continuing the process.
Outgoing sequence flows are evaluated in the order they are defined in the XML file.
A parallel gateway allows to model parallel flows that should work in parallel. It is displayed as a gateway with an “+” icon inside.
The parallel gateway doesn’t evaluate flow conditions. It always follows all the paths. A parallel gateway can be used to fork or join executions:
fork: All outgoing sequence flows are followed in parallel. In the example, Task A and Task B are executed in parallel.
join: All concurrent executions that arrive to the parallel gateway will wait until all executions arrive, then the process continues. In the example, the process will wait for tasks A and B to be completed before continuing to Task C.
A single parallel gateway can do both join and fork if there are multiple incoming and outgoing sequence flows.
It works like a parallel gateway, with the difference that it evaluates the flow conditions to determine which paths to follow.
Similar to the parallel gateway, it can be used to fork or join executions:
fork: All outgoing sequence flows are evaluated. An execution is created for every path that resolves to true. In the example above, both tasks A and B might or might not be executed, depending on the evaluation of their flow conditions. For every execution that evaluates to true, it will create a process token.
join: Wait for all sequence flows that have a process token, in other words, it waits only for the paths that will be executed. This is a very important difference with the parallel gateway.
A single inclusive gateway can do both join and fork if there are multiple incoming and outgoing sequence flows. In that case, the gateway will first wait for the executed sequence flows, and then will split the execution, considering the flow conditions.