Architecting and designing > Business Process Analysis (BPA) > BPMN > Modeling Gateways on BPMN diagrams > Gateways
  
Gateways
A gateway is used to model decisions, merges, forks, and joins on a BPMN business process diagram.
A Decision can be thought of as a question that is asked at a point in the Process Flow. The question has a defined set of alternative answers, which are in effect Gates. Each Decision Gate is has a condition specified for it, and an outgoing Sequence Flow. When a Gate is chosen, the corresponding Sequence Flow path is taken. A Token arriving at the Decision is directed down the appropriate path, based on the chosen Gate.
Stereotypes
You can set the stereotype of a gateway, and thus change the logic specified by the Decision point. Gateways are used to specify all types of business process Sequence Flow behavior, as described below:
Expressing exclusive decisions and merges (XOR): You can model data-based decisions and merges, and event-based decisions. In general, exclusive means only one output (for example, one or the other but not both).
Expressing Inclusive Decisions and Merges (OR): You model OR-joins. In general, inclusive means more than one output for a decision (for example, one or the other or both).
Expressing complex decisions and merges: You model complex decisions and merging.
Expressing parallel forks and joins (AND): You model AND-splits (for forking) and AND-joins (for joining).
Exclusive Decisions and Merges (XOR)
The BPMN specification states that you should be consistent in the use of the “X” internal indicator. That is, a diagram should not have some Gateways with an indicator and some Gateways without an indicator.
This graphic is described in the surrounding text.
or
This graphic is described in the surrounding text.
A useful expression that you can use to remember the logic of an Exclusive Decision (XOR) decision is “one or the other but not both”. Actually, there might be more than two outgoing Sequence Flows for an XOR decision. In any case, only one Sequence Flow output is taken. There are two types of XOR decisions: Data-Based and Event-Based.
Data-based XOR decisions
Data-Based XOR decisions are the most commonly used type of Gateway. A data token traverses the Process Flow and arrives at the XOR gateway. The path that it flows out on is chosen based on condition expressions for each gate. It can only go out on one flow. The condition expressions use the values of process data – the value of the data token itself: to determine which path should be taken. This is where the name data-based decision comes from.
Event-based XOR decisions
Event-based gateways are a recent development in the field of business process management. An event-based XOR gateway represents a branching point where the alternatives are based on an event that occurs at that point in the process flow. A specific event, usually the receipt of a message, determines which of the paths will be taken.
Event-based gateways map to the BPEL4WS pick or the BPML choice elements.
For example, you can model a process flow wherein the system waits for a response from a customer. The system performs one set of activities if the customer responds Yes and another set of activities if the customer responds No. The customer's response will either be a Yes message or a No message, and that determines which path is taken. The Yes message and the No message are completely different messages - they are not the same message with different values within a property of the message.
Best practices when drawing Gateways
You can only draw Sequence Flows to and from a Gateway. You cannot draw Message Flow lines to or from a gateway.
You are not required to make incoming and outgoing Sequence Flows connect to the corners of the diamond gateway symbol. Sequence Flows can connect to any position on the boundary of the Gateway diamond symbol.
This graphic is described in the surrounding text.
If the gateway has no incoming Sequence Flow, and there is no Start Event for the process flow, then the gateway’s divergence behavior shall be performed when the process flow is instantiated.
Note In picture above, the conditional outputs (Yes and No) are created by drawing a Message Flow from the line, and specifying a Condition (for example, Yes or No as in the above example) in the line’s Execution (Condition) tab.
See also
Modeling Gateways on BPMN diagrams