Saturday, December 26, 2015


Gateways in Alfresco Activiti
Introduction
The Gateways are used to control the flow of workflow execution process using conditions.
It is a gating  mechanism that allows/prevents passage of flow through the gateway.
There are four different gateways in Activiti:
Exclusive Gateway
Parallel Gateway
Inclusive Gateway
Event based Gateway

Exclusive Gateway 
The Exclusive Gateway is used to make a decision in workflow model. When the execution arrives at exclusive gateway, the sequence flow is decided based on the way it is defined. 
The symbol is diamond shape with an X inside it.
All the outgoing flows must be defined with a flow condition either a fixed value or based of flow value or flow outcome. One of the outgoing flow must be marked as default condition, else validation error is thrown.   


In the above workflow, the first sequence has a condition as true (Approve) whereas, the second sequence condition is false (Reject).
Either one condition will be satisfied when using Exclusive Gateway.
When the User A Task approves the workflow, it goes to User B Task.
When the User A Task rejects the workflow, it goes to User C Task.


Parallel Gateway 
The Parallel Gateway allows to use parallel incoming (join)  / outgoing (fork) flows in the workflow.i.e. the concurrent tasks can be performed in the workflow gateway.
The symbol is diamond shape with a + inside it.

In a fork, all outgoing sequence flows are followed in parallel, which creates one individual execution for each sequence flow.
 

In a join, all concurrent executions arriving at the parallel gateway wait at the gateway until an execution has arrived for every incoming sequence flow. Then the process continues past the joining gateway. Note that the gateway simply wait until the required number of executions has been reached and does not check if the executions are coming from different incoming sequence flow.




A single parallel gateway can both fork and join, if there are multiple incoming and outgoing sequence flow. The gateway will first join all incoming sequence flows, before splitting into multiple concurrent paths of executions.

 
In Parallel gateway, the conditions defined in the incoming/ outgoing flows are NOT evaluated and it is ignored.


Inclusive Gateway 
The Inclusive Gateway is more or less a combination of Exclusive gateway and Parallel gateway.
Similar to Exclusive gateway, we can define conditions on outgoing sequence flow and it will be evaluated during  execution.
Similar to Parallel gateway,  it can take more than sequence flow in the workflow process.
All the outgoing sequence flow is evaluated based on defined condition and if its true, concurrent execution takes place for each sequence flow.

The symbol is diamond shape with a O inside it.


Event based Gateway 
The Event based gateway is used based on events in workflow process.
In Event gateway, each outgoing sequence flow is connected to intermediate catching event.
Below are the restrictions applied to Event gateway:
1. There should be two or more outgoing sequence flow from Event gateway
2.  Only intermediate catching events can be added after Event based gateway. In Activiti, receive tasks are not supported after this gateway.
3. There must be single incoming sequence flow for event based gateway

The symbol is diamond shape with an uncoloured + inside it.



No comments:

Post a Comment