When we start implementing Business process in BPM engine there are number of possible complexities which we may encounter the simple reason is that each business has their own set of process which has its own complexity.
In some workflow scenarios, it is necessary to support a Fork where the number of paths is only known at run-time. For example, in a parallel review process where the review task is allocated to ‘N’ people for review
To support this scenario following things are provided in jbpm,
Fork: Spawns multiple concurrent paths of execution.
Join: Joins multiple paths into a single path becomes a wait state until all tokens have reached the join.
ForEachFork action: Which helps to implement fork and join loop.
variable represents the name of the variable to create in each fork that holds the collection entry
As with a simple jPDL Fork, a ForEachFork must be balanced with a Join. A simple parallel review could be described as follows:
Graphically it can be represented as follow
First we are creating branches of workflow task through fork and then joining them at particular task through join node. Before completing workflow we have to join all forked threads to make sure all of them are finished.