Home

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.

1
2
3
4
5
6
7
8
9
10
11
<node name="startreview">
   <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
     <foreach>collection</foreach>
     <var>variable</var>
   </action>
</node>

collection represents a Javascript expression in the form of #{expression} which resolves to a collection (of any type). A path is forked for each entry of the collection.

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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<node name="startreview">
   <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
     <foreach>#{people.getMembers(wf_reviewGroup)}</foreach>
     <var>reviewer</var>
   </action>
   <transition name="review" to="review" />
</node>
 
<task-node name="review">
   <task name="wf:reviewTask">
     <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
       <actor>#{reviewer}</actor>
     </assignment>
   </task>
   <transition name="reject" to="endreview" />
   <transition name="approve" to="endreview">
</task-node>
 
<join name="endreview">
   <transition to="isapproved" />
</join>

Graphically it can be represented as follow

Fork and Join in workflow

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.

Looking for quality Alfresco Web Hosting? Look no further than Arvixe Web Hosting!

Publicités

Laisser un commentaire

Choisissez une méthode de connexion pour poster votre commentaire:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s