Activiti 6:加入两个并行任务时,带有Async Executor的并行网关不起作用

时间:2018-07-26 07:02:48

标签: activiti bpmn

<?xml version="1.0" encoding="UTF-8" ?>

<definitions id="definitions"
         targetNamespace="http://activiti.org/bpmn20"
         xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:activiti="http://activiti.org/bpmn">

<process id = "Process1" name = "Process1" isExecutable="true">

    <startEvent id="start"/>

    <serviceTask id="joinFlow" activiti:class= "joinFlowClass"  />
    <serviceTask id="SubProcess1" activiti:class= "SubProcess1Class" activiti:async="true" activiti:exclusive="false"  />
    <serviceTask id="SubProcess2" activiti:class= "SubProcess2Class" activiti:async="true" activiti:exclusive="false" />

    <sequenceFlow id="flow1" sourceRef="start" targetRef="parallelGtw" />

    <parallelGateway id = "parallelGtw" activiti:async="true" activiti:exclusive="false" />
    <sequenceFlow sourceRef="parallelGtw" targetRef="SubProcess1" />
    <sequenceFlow sourceRef="parallelGtw" targetRef="SubProcess2" />

    <sequenceFlow sourceRef="SubProcess1" targetRef="join" />
    <sequenceFlow sourceRef="SubProcess2" targetRef="join" />

    <parallelGateway id="join" />
    <sequenceFlow sourceRef="join" targetRef="joinFlow" />
    <sequenceFlow sourceRef="joinFlow" targetRef="end" />

    <endEvent id = "end"/>
</process>
</definitions>

在上面的Activiti XML中...

并行网关分叉了两个任务,它们在两个不同的线程(activiti:async="true" activiti:exclusive="false")中执行。

但是发生的是,在将两个并行任务的结果合并之前,整个过程已经完成。

图形渲染: Graphical rendering of BPMN process

您能告诉我如何加入并行任务并继续其余流程吗?

1 个答案:

答案 0 :(得分:1)

您还应该为“加入”并行网关指定 activiti:async =“ true”