AnsweredAssumed Answered

Async service task not executing

Question asked by afshad on Apr 13, 2012
Latest reply on Apr 21, 2012 by trademak
If I have two starting tasks that are async = true and exclusive = false then it seems like Activiti starts neither of them. The delegate execute() method is never entered. When I call getActiveActivitiIds() as shown below, it returns me the first and second service task names and doesnt seem to quit.

            ProcessInstance proc = runtimeService.startProcessInstanceByKey(BPMNCreator.INSTANCE.getWorkflowProcessID());
            while(runtimeService.getActiveActivityIds(proc.getId()).size() > 0) {
                List<String> activeActivityIds = runtimeService.getActiveActivityIds(proc.getId());
                for(String str : activeActivityIds) {
                    System.out.println("Currently executing: "+str);
                }
                Thread.sleep(100);
            }
The xml flow:
<parallelGateway id="parallelgateway1" name="Parallel Gateway"></parallelGateway>
    <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="parallelgateway1"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="parallelgateway1" targetRef="serviceTask1"></sequenceFlow>
    <sequenceFlow id="flow3" name="" sourceRef="parallelgateway1" targetRef="serviceTask2"></sequenceFlow>
    <parallelGateway id="parallelgateway2" name="Parallel Gateway"></parallelGateway>
    <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="serviceTask3"></sequenceFlow>
   
<sequenceFlow id="flow7" sourceRef="serviceTask3" targetRef="endevent1"/>
<endEvent id="endevent1" name="End"/>

The loop above never stops and just prints the first and second service Task ids but never actually executes them.  I expect it to print all the service task ids and then break.
It works fine when i dont use a parallel gate way or async = true and have all three service tasks sequential order.
Whats could be going wrong? Why isnt it starting the tasks?

Thanks

Outcomes