Parallel

Parallel gateways define multiple paths, or convergence and synchronization of multiple paths. Parallel gateways can be of two types: join and fork.

Joining

The joining type of parallel gateway synchronizes concurrent branches or threads of execution. The gateway is activated if it receives an execution token from every incoming sequence flow and the token is consumed.

To model this behavior a rule is required whose condition would require the incoming messages from each incoming sequence flow to be asserted to the Process Rete and each message context providing identification of the sequence path traveled and the last flow node it originated from.

If there are excess tokens at an incoming sequence flow, these tokens remain at this sequence flow after the execution of the gateway. This could mean that the out of context message has arrived and it needs to be correlated there it should also get asserted.

Forking

Parallel gateway forking is used to spawn concurrent threads or branches.

This involves creating a job hierarchy that is, parent job spawns child jobs and each job keeps progressing on the assigned sequence flow.

If the sequence flow activities have no outgoing sequence flow and there are no end events in the containing process or subprocess, the activities terminate and termination semantics for the container are applied.

The parent job can have multiple child jobs but a child job can have only one parent job. Each job can be identified by <parent job id>.<child job id>, and it can have its own job context. All the concurrent jobs are scheduled to be executed immediately after the gateway synchronization in the rule action.