Control Process Flow with Gateways
Gateways are flow elements that define the flow of your business process. Gateways determine the path a token takes through a business process. They define control points within your business process by splitting and merging paths. When possible, gateways are used for paths that are exceptions to, or deviate from, the default path of the business process.
Exclusive Gateway: Take Only One Path (Data Condition)
The exclusive gateway lets you split your business process into two or more paths. However, the business process only continues down one of the paths even if multiple outgoing sequence flows are present. Exclusive gateways can have conditional outgoing sequence flows and must have at least one default outgoing sequence flow.
You can define expressions that are used to determine if your process continues down a conditional sequence flow. See Work with Expressions.
Evaluating the Flows of an Exclusive Gateway
When a process token reaches an exclusive gateway, the outgoing sequence flows are evaluated until one of them evaluates to True.
You can define the order in which the flows are evaluated by configuring the properties for the gateway.
-
If only one outgoing sequence flow evaluates to True, then the process token continues down that outgoing sequence flow to the next flow element.
-
If more than one outgoing sequence flow evaluates to True, then the process token continues down the first sequence flow according to the order you defined in the gateway properties.
-
If none of the outgoing sequence flows evaluates to True, then the process token moves down the default outgoing sequence flow. Therefore, you must define a default outgoing sequence flow for the exclusive gateway.
Unlike other gateways, the exclusive gateway doesn’t require a corresponding merge to be explicitly defined in your process after splitting.
Note:
The exclusive gateway can also merge incoming sequence flows. However, there’s no synchronization with other tokens that may be coming from other paths within the process flow. If other tokens arrive at an exclusive gateway merge, then they’re passed through as is. If you’re synchronizing tokens or performing evaluations on incoming sequence flows, then you should use a different type of gateway.Example of an Exclusive Gateway
The following diagram shows an example of the exclusive gateway used within a Loan Approval business process. Here, the exclusive gateway is used to evaluate if the loan request is approved or if more information is required.
This evaluation is determined by the expression defined for the outgoing conditional sequence flow. If the expression evaluates to true, then the process flow proceeds down the No path. If it evaluates to false, then the process flow proceeds down the path of the default outgoing sequence flow.
Inclusive Gateway: Take One or More Paths
The inclusive gateway lets you split your business process into two or more paths. Unlike the exclusive gateway, however, a token may flow down one OR more of these paths depending on how the outgoing conditional sequence flows are evaluated.
The inclusive gateway requires a split-merge pair. When you add an inclusive gateway to your business process, the split and merge flow objects are automatically created:
Description of the illustration inclusive-gateway-pair.png
The merge portion of the gateway is required. However, you don’t have to ensure that all paths out of the split return to the merge.
Although it’s possible to have process paths that split at a gateway without merging through the gateway, it’s not a good practice and not recommended.
Note:
If you delete the merge gateway from a business process, the corresponding split gateway is also deleted.Splitting and Merging Inclusive Gateways
The inclusive gateway splits a business process similar to the exclusive gateway, but allows tokens to proceed down one OR more outgoing sequence flows. You can define any number of outgoing conditional sequence flows for an inclusive gateway split. You must define at least one default sequence flow.
When a token arrives at an inclusive gateway, the expressions of its conditional sequence flows are evaluated.
Next, a token is generated for each of the conditional sequence flows that evaluates to True. A token is generated for the default sequence flow only if none of the conditional sequence flows evaluate to True.
These tokens are joined at the merge of the inclusive gateway. When a token reaches the merge gateway, it waits until all the tokens generated by the split have reached the merge. After all the tokens have reached the merge of the inclusive gateway, the merge is complete, and the token continues to the next sequence flow after the gateway.
Parallel Gateway: Take All Paths Simultaneously
The parallel gateway lets you split your business process into two or more paths when you want your process flow to follow all paths simultaneously. The parallel gateway is useful when your business process must perform multiple tasks in parallel.
The parallel gateway requires a split-merge pair. When you add a parallel gateway to your business process, the split and merge flow objects are automatically created:
Description of the illustration parallel-gateway-pair.png
The merge portion of the gateway is required. However, you don’t have to ensure that all paths out of the split return to the merge.
Although it’s possible to have process paths that split at a gateway without merging through the gateway, it’s not a good practice and not recommended.
Note:
If you delete the merge gateway from a business process, the corresponding split gateway is also deleted.Splitting and Merging Parallel Gateways
When a token arrives at a parallel gateway, the parallel gateway creates a token for each outgoing sequence flow. The split of the parallel gateway doesn’t evaluate any of the outgoing sequence flows.
You can also use the parallel gateway to merge process paths split by the parallel gateway. The merge of the parallel gateway waits for a token to arrive from each of the incoming sequence flows. After all tokens arrive, only one token is passed to the outgoing sequence flow.
Note:
You must design your business process so that a token arrives for each incoming sequence flow for the merging parallel gateway. If you don’t, your business process can freeze if the merge is expecting tokens that don’t arrive.Example of a Parallel Gateway
In this example, a Sales Quote process uses a parallel gateway at the approval stage. The diagram shows how the parallel gateway is used to execute all process paths at the same time.
Description of the illustration parallel-gateway-example.png
Event-Based Gateway: Take Only One Path (Event Occurrence)
The event-based gateway allows you to branch your process flow based on the possibility that an event may occur. Depending on the context, the event may be one of several types.
The event-based gateway allows you to anticipate the possibility that several types of events may occur at a specific point in your process. It's similar to the exclusive gateway, but instead of selecting a path based on data-specific conditions (expressions), the event-based gateway selects a path based on the occurrence of an event within your process.
For example, in an order processing process, you may reach a point in your process when no stock is currently available. The process may have to wait until stock is available, but can’t wait indefinitely. By using an event-based gateway, your process can wait for a message saying new stock has been received (using a message catch event) or it can continue if no message is received after a certain amount of time has passed (using a timer event).
Target Events for Event-Based Gateways
The event-based gateway is different from other gateways in that decisions about process flow are based on an event rather than data-specific conditions. For an event-based gateway, you define two or more of the following target events:
-
Message catch events: When initiating a process using a message catch event, the process must be invoked using a message throw event.
-
Timer catch events: Generally, only one timer event is used following an event-based gateway.
-
Receive tasks: You can use the receive task to initiate a process instance following an event-based gateway. However, the process must be invoked from a send task within the calling process.
Note:
You can’t mix message events and receive tasks within the same event-based gateway.The target elements can only have incoming sequence flows from the event-based gateway. They can’t have sequence flows from other parts of the process. Although the event-based gateway allows you to plan that multiple events may occur in your process, only one event is triggered within the process instance. When the first event in the event-based gateway is triggered, the path that comes after that event is followed.
When you add an event-based gateway to a process, no associated target events are created. When you delete an event-based gateway, any outgoing sequence flows are also deleted. The associated events aren’t deleted.
Process Start with an Event-Based Gateway
You can also use an event-based gateway at the beginning of a process to create a new process instance. This is similar to having multiple start events within a process.
To allow an event-based gateway to create a new process instance:
-
You must enable the Instantiate property of the event-based gateway.
-
You can’t have any incoming sequence flows to the event-based gateway.
-
Your process must have at least one other start event, for example a message start event, in addition to the event-based gateway.
Although the event-based gateway can be used to create a new process instance, it doesn’t accept data input from another process. Any data that must be passed to the process instance must be configured using the target events.