AnsweredAssumed Answered

Running parallel tasks with acitiviti

Question asked by hellowrakesh123 on Jun 17, 2012
Latest reply on Jul 4, 2012 by hellowrakesh123
Hi,
I am new with Activiti and trying to get the parallel gateways work but i couldn't get it working the way I was expecting. Am I doing something wrong here?

I have 2 tasks Build-1 and Build-2, I want to fork off the 2 tasks at the same time as soon as the workflow starts.

When i am running the workflow, its first starting the first process (Build-1) and after it completes, it starts the other (Build-2). I am not sure what is wrong here. I tried using activiti:async but it didnt work for me.

<process id="ccaProcess" name="ccaProcess">
      <startEvent id="startevent1" name="Start"></startEvent>
       <serviceTask id="servicetask1" name="Build-1" activiti:class="com.mycomp.step.cca.bpm.CcaDelegate"></serviceTask>
       <serviceTask id="servicetask2" name="Build-2" activiti:class="com.mycomp.step.cca.bpm.CcaDelegate"></serviceTask>
       <parallelGateway id="parallelgateway2" name="Parallel Gateway"></parallelGateway>
       <endEvent id="endevent1" name="End"></endEvent>
       <sequenceFlow id="flow4" name="" sourceRef="servicetask1" targetRef="parallelgateway2"></sequenceFlow>
       <sequenceFlow id="flow5" name="" sourceRef="servicetask2" targetRef="parallelgateway2"></sequenceFlow>
       <sequenceFlow id="flow6" name="" sourceRef="parallelgateway2" targetRef="endevent1"></sequenceFlow>
       <parallelGateway id="parallelgateway3" name="Parallel Gateway"></parallelGateway>
       <sequenceFlow id="flow8" name="" sourceRef="parallelgateway3" targetRef="servicetask1"></sequenceFlow>
       <sequenceFlow id="flow9" name="" sourceRef="parallelgateway3" targetRef="servicetask2"></sequenceFlow>
       <sequenceFlow id="flow10" name="" sourceRef="startevent1" targetRef="parallelgateway3"></sequenceFlow>
   </process>

Here is the java code i used to start the process:
runtimeService.startProcessInstanceByKey("ccaProcess");

– Assume runtimeService is a spring managed bean.
– The Delegates implement JavaDelegate.

Outcomes