The Exclusive Gateway (XOR)
Usually, in a business process, not all tasks are always executed. In most business scenarios, decisions are part of the process to control how to proceed in certain cases. These scenarios obviously affect the design and structure of your process model. First, this means that within the process model we have to split up the sequence flow into different paths.
In the previous lesson, we learned how to use events and tasks to create our first own process model. We connected a start event that represented a need, hunger, with several activities, buying, preparing, and eating a meal, to reach the satisfying feeling no longer being hungry.
However, wouldn't it be even more satisfying to prepare and eat a meal of our choice?
Exclusive Gateway (XOR)
Using the Exclusive Gateway for Splitting (XOR Split)
Based on our previous meal example, let's assume we have different groceries at home to cook something delicious. Driven by hunger, we must now decide about what we want to eat.
The exclusive gateway reads out the result of our decision (select meal) to guide us to the next task. The process flow is being split up into several ones but only one path can be chosen at a time.
In other words: this is an either/or decision.
Reaching the Process Goal
Add Missing Tasks
You might have noticed that there was an important factor missing in our previous example - we never ate, as the process has ended after our meal has been prepared. Our initial goal (being not hungry anymore) was not fulfilled. To be more precise: The process is not modeled completely.
So, let's add the tasks to ensure that at the end of the process, we're not hungry anymore.
Merging Process Branches
Using the Exclusive Gateway for Merging (XOR Join)
Our previous solution at least ensures we reach our goal, but increases the complexity of our process as:
- the "Eat meal" task does not depend on the meals, but applies the same to all different meals.
- we created the same process goal (end event) multiple times for each branch.
To avoid the problems above, we must find a way of merging all split branches with the original process flow. Fortunately, we can use the exclusive gateway again, as demonstrated in the image above, Using the Exclusive Gateway for Merging (XOR Join).
Conclusion
When you split with it, merge with it.
Exclusive gateways:
- have a splitting behavior to route to the next required task, based on a certain condition.
- have a merging behavior, to join different branches in the process with the main flow.
- must be used pairwise. That means, if a process flow has been split into several branches with an XOR gateway, the joining gateway must also be an XOR gateway.
- have exceptions to this. If the sequence flows go to different end events, a splitting gateway does not have to be merged. This means that the single paths are moved into different paths and do not have to be merged anymore.
Note
The BPMN standard also allows exclusive gateways to be used without having to merge them again. Therefore, this is not a syntax error. However, it is recommended to merge the sequence flows again with an exclusive gateway, because this way the diagram remains well-structured and errors can be avoided.Using Exclusive Gateways as Standalone Decisions
Exclusive gateways are not decisions. Why? Because they are not tasks but rather a control element to route the next task, based on the result of a decision that was made previously.
The exclusive gateway itself is not a decision.
Select meal is a task that must be completed before any of the outgoing paths can be selected at the XOR gateway.
A Decision Is Missing.
Gateways Don't Replace (Decision) Tasks
Although it looks like there is a decision in this process example, in fact, there is none. A gateway alone is stateless as it's only an instrument to control the next step based on information. In contrast to tasks, a person cannot "own" (be responsible for) a gateway.
Referring to the process example above, it means:
- The actual decision (select meal) is missing and hence never made.
- The information of a selected meal is "simply available" from the beginning but is not determined as part of the process.
- Although the XOR gateway is in Tim's lane, he is not responsible for the "routing", as a gateway is just a stateless instrument. Furthermore, it doesn't matter in which lane a gateway is placed. It's only important to whom the next task is assigned.
Getting Back to Our Token Concept
Let's have a look how the process is applied when using splitting and merging exclusive gateways.
Naming Convention for XOR Gateways
As we have seen with tasks and events, elements in BPMN do follow a certain naming convention, in order to understand them quickly and intuitively.
XOR gateways and in particular gateways that handle results/conditions in a process, also have naming conventions. These are:
- Exclusive gateways must be labeled with a question.
- The outgoing conditions (sequence flows) must be labeled with the answer to the question.
- All outgoing conditions must exclude each other. For example, yes/no.
- Merging Gateways are never labeled.