Hi, I have a very simple parallel gateway process I’m using to create 2 User Tasks, each User Task runs a separate sub-process in parallel. The process works fine except the Process Instance is left after all sub-processes complete.
It’s probably something obvious, but I can’t seem to locate how to complete the Process Instance :
<process id="simple-parallel">
<startEvent id="theStart" />
<sequenceFlow id="flow001" sourceRef="theStart" targetRef="theFork" />
<parallelGateway id="theFork" />
<sequenceFlow id="flow-002" sourceRef="theFork" targetRef="ParallelTaskA" />
<sequenceFlow id="flow-003" sourceRef="theFork" targetRef="ParallelTaskB" />
<userTask id="ParallelTaskA" name="Parallel Task A" />
<sequenceFlow id="flow-004" sourceRef="ParallelTaskA" targetRef="parallel-task-a" />
<serviceTask id="parallel-task-a" flowable:delegateExpression="${beanParallelTaskA}"/>
<sequenceFlow id="flow-004a" sourceRef="parallel-task-a" targetRef="subProcessEnd1" />
<endEvent id="subProcessEnd1" />
<userTask id="ParallelTaskB" name="Parallel Task B" />
<sequenceFlow id="flow-005" sourceRef="ParallelTaskB" targetRef="parallel-task-b" />
<serviceTask id="parallel-task-b" flowable:delegateExpression="${beanParallelTaskB}"/>
<sequenceFlow id="flow-005a" sourceRef="parallel-task-b" targetRef="subProcessEnd2" />
<endEvent id="subProcessEnd2" />
</process>
UPDATE : Added a join and pointed both sub-processes to the join :
<parallelGateway id="theJoin" />
<sequenceFlow sourceRef="theJoin" targetRef="archiveOrder" />
<userTask id="archiveOrder" name="Archive Instance" />
<sequenceFlow sourceRef="archiveOrder" targetRef="theProcessEnd" />
<endEvent id="theProcessEnd" />
but now I get an error/exception :
2018-10-29 14:09:38 - FlowableController().doCompleteTaskWithInput() - Encountered an error/exception : [ProcessInstance[115001] was updated by another transaction concurrently]
And the Process Instance remains still.
tia,
adym
Hi, I did some trial-n-error experiments using my simple parallel process XML. Also did some reading on various postings :
https://community.alfresco.com/thread/219003-running-parallel-tasks-with-acitiviti
https://www.flowable.org/docs/userguide/index.html#bpmnConcurrencyAndTransactions
I did manage to get this working so that the Process Instance gets completed, BUT the combinations of async and exclusive are IMPORTANT. Also, in order to work the Async Job Executor needs to be turned on…my was initial false (off) :
ProcessEngineConfiguration ltheCfg = getProcessEngine().getProcessEngineConfiguration ();
boolean ljobActivator = ltheCfg.getAsyncExecutor().isActive();
if (!(ljobActivator)) {
ltheCfg.getAsyncExecutor().start (); // Turns on the Async Job Executor...
}
ljobActivator = ltheCfg.getAsyncExecutor().isActive();
I fiddled with the following settings on the serviceTask XML elements and parallelGateway XML elements :
flowable:async="false" - On both serviceTask and parallelGateway
flowable:async="true" - On both serviceTask and parallelGateway
flowable:exclusive="false" - On serviceTask
flowable:exclusive="true" - On serviceTask
The final XML I settled on was :
<process id="simple-parallel">
<startEvent id="theStart" />
<sequenceFlow id="flow001" sourceRef="theStart" targetRef="theFork" />
<parallelGateway id="theFork" flowable:async="true" />
<sequenceFlow id="flow-002" sourceRef="theFork" targetRef="ParallelTaskA" />
<sequenceFlow id="flow-003" sourceRef="theFork" targetRef="ParallelTaskB" />
<userTask id="ParallelTaskA" name="Parallel Task A" />
<sequenceFlow id="flow-004" sourceRef="ParallelTaskA" targetRef="parallel-task-a" />
<!--
<serviceTask id="parallel-task-a" flowable:delegateExpression="${beanParallelTaskA}" flowable:async="false" />
<serviceTask id="parallel-task-a" flowable:delegateExpression="${beanParallelTaskA}" flowable:async="true" />
-->
<serviceTask id="parallel-task-a" flowable:delegateExpression="${beanParallelTaskA}" flowable:async="true" flowable:exclusive="false" />
<sequenceFlow id="flow-004a" sourceRef="parallel-task-a" targetRef="theJoin" />
<userTask id="ParallelTaskB" name="Parallel Task B" />
<sequenceFlow id="flow-005" sourceRef="ParallelTaskB" targetRef="parallel-task-b" />
<!--
<serviceTask id="parallel-task-b" flowable:delegateExpression="${beanParallelTaskB}" flowable:async="false" />
<serviceTask id="parallel-task-b" flowable:delegateExpression="${beanParallelTaskB}" flowable:async="true" />
-->
<serviceTask id="parallel-task-b" flowable:delegateExpression="${beanParallelTaskB}" flowable:async="true" flowable:exclusive="false" />
<sequenceFlow id="flow-005a" sourceRef="parallel-task-b" targetRef="theJoin" />
<parallelGateway id="theJoin" flowable:async="true" />
<sequenceFlow sourceRef="theJoin" targetRef="theProcessEnd" />
<endEvent id="theProcessEnd" />
</process>
hth,
adym
Hey Adym,
Just for my information, was the async executor explicitly disabled by you in the default run or was this part of a test?
Cheers,
Filip