JBoss Community

How to start/spawn 'n' subprocesses for 'n' users using JBPM-4.3.

reply from Maciej Swiderski in jBPM - View the full discussion

You are looking for something like for-each activity that is of type multi instance. It is part of 4.4 release that is coming out in few days.

Based on the input (given as list, array, etc) it will create new instances of the activity which is following the for-each. Below you can find a code snippet that illustrates it:

 

 

   <foreach var="department" in="#{departments}" g="111,60,48,48" name="foreach">
      <transition to="Collect data"/>
   </foreach>

   <task candidate-groups="#{department}" g="201,58,92,52" name="Collect data">
      <transition to="join1"/>
   </task>

   <join g="343,59,48,48" multiplicity="#{quorum}" name="join">
      <transition to="end1"/>
   </join>

In the example there will be a variable of type list available on runtime, let's assume that there will be four departments involved. Foreach will create 4 tasks, one for each department. At the and (join) you can use multiplicity attribute to control the flow, for instance you can say that once 3 departments did collect all data it is enough and process should not wait for the last one.

 

P.S.

Search development forum for some details about for each activity

 

HTH

Reply to this message by going to Community

Start a new discussion in jBPM at Community