Thursday, December 31, 2015

Boundary Events

Boundary events are attached to a task in workflow and “listen” for a trigger signal to perform an action.  
When the trigger signal is received, the workflow task is either interrupted and the sequence flow going out of the event is followed (interrupting behavior) or a new execution is created from the boundary event (non-interrupting behavior).
There are various boundary events used for different actions in workflow process:
·         Boundary error event
·         Boundary timer event
·         Boundary signal event
·         Boundary message event

Boundary error event

The Boundary error event is an interrupting event that catches error thrown inside the activity boundaries.

Once the error is caught, the Boundary error event handles it in the way we define it.
The best example for Boundary error event is bad online transaction. When the transaction is failed due to some reason, the user will be returned to homepage with the error message as “Transaction failed”.

The symbol is a circle with a lightning icon inside.




Boundary timer event

The Boundary timer event adds a timer on workflow process and when the timer is completed, the new sequence flow defined out of boundary will be followed.

The best example for Boundary timer event is password reset option. When the user did not reset the password within the given time, the reset link becomes invalid.
The symbol is a circle with a timer icon inside.


Boundary signal event

A boundary signal event listens to a signal being fired (from within the process instance or system-wide) while the activity upon which the event is defined is active.

The symbol is a circle with a triangle icon inside.


Boundary message event

When a boundary message event appears on the workflow process, it indicates that an incoming message can interrupt the sequence flow, and will divert the process from the “normal” flow to a defined “exception” flow.

The best example for Boundary message event is online order cancellation. When the user sends a cancellation message to the online seller, the order is cancelled from being shipped.
The symbol is a circle with an envelope icon inside.




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.