Different behaviour between Parallel and Inclusive Gateways (tests using Async and/or Exclusive flags)

Hello,

I have done some tests on Parallel and Inclusive Gateways with combinations of Async and Exclusive flags, and I have some strange behaviours.

Tests done on processes with 3 parallel branches (1 branch with a catching message event).

I have used 2 test sets: 1 using Parallel gateways, 1 using Inclusive gateways.
And the Inclusive gateway use always the 3 branches (should so be equivalent to the parallel gateway).

Test set 1: Parallel gateways


Test set 2: Inclusive gateways
image
For each set, different settings on the Join gateway (4):

  • Sync (no Async & Exclusive flags)
  • Sync & Exclusive
  • Async
  • Async & Exclusive

And here are the unit test results:


T E S T S

@@@@@@@@@@ TEST_JUNIT_PARALLEL_SYNC
Thu May 09 11:28:38 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:28:38 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:28:41 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:28:41 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:28:41 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:28:48 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:28:48 CEST 2019 LAST STEP 5

11:28:48,171 [flowable-async-job-executor-thread-1] ERROR org.flowable.job.service.impl.asyncexecutor.DefaultAsyncRunnableExecutionExceptionHandler - Job 44 failed
org.flowable.common.engine.api.FlowableOptimisticLockingException: ProcessInstance[36] was updated by another transaction concurrently

at java.lang.Thread.run(Thread.java:748)

Thu May 09 11:28:58 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:29:08 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:29:08 CEST 2019 LAST STEP 5

@@@@@@@@@@ TEST_JUNIT_PARALLEL_SYNC_EXCLUSIVE
Thu May 09 11:29:19 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:29:19 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:29:22 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:29:22 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:29:22 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:29:29 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:29:29 CEST 2019 LAST STEP 5

11:29:29,458 [flowable-async-job-executor-thread-1] ERROR org.flowable.job.service.impl.asyncexecutor.DefaultAsyncRunnableExecutionExceptionHandler - Job 103 failed
org.flowable.common.engine.api.FlowableOptimisticLockingException: ProcessInstance[95] was updated by another transaction concurrently

at java.lang.Thread.run(Thread.java:748)

Thu May 09 11:29:39 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:29:49 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:29:49 CEST 2019 LAST STEP 5

@@@@@@@@@@ TEST_JUNIT_PARALLEL_ASYNC
Thu May 09 11:29:09 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:29:09 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:29:12 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:29:12 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:29:12 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:29:19 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:29:19 CEST 2019 LAST STEP 5

@@@@@@@@@@ TEST_JUNIT_PARALLEL_ASYNC_EXCLUSIVE
Thu May 09 11:29:50 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:29:50 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:29:53 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:29:53 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:29:53 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:30:00 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:30:00 CEST 2019 LAST STEP 5

@@@@@@@@@@ TEST_JUNIT_INCLUSIVE_SYNC
Thu May 09 11:30:31 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:30:31 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:30:34 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:30:34 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:30:34 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:30:41 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:30:41 CEST 2019 LAST STEP 5

11:30:41,208 [flowable-async-job-executor-thread-2] ERROR org.flowable.job.service.impl.asyncexecutor.DefaultAsyncRunnableExecutionExceptionHandler - Job 194 failed
org.flowable.common.engine.api.FlowableOptimisticLockingException: ProcessInstance[186] was updated by another transaction concurrently

at java.lang.Thread.run(Thread.java:748)

Thu May 09 11:30:51 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:31:01 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:31:01 CEST 2019 LAST STEP 5

@@@@@@@@@@ TEST_JUNIT_INCLUSIVE_SYNC_EXCLUSIVE
Thu May 09 11:28:07 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:28:07 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:28:10 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:28:10 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:28:10 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:28:17 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:28:17 CEST 2019 LAST STEP 5

11:28:17,203 [flowable-async-job-executor-thread-2] ERROR org.flowable.job.service.impl.asyncexecutor.DefaultAsyncRunnableExecutionExceptionHandler - Job 13 failed
org.flowable.common.engine.api.FlowableOptimisticLockingException: ProcessInstance[5] was updated by another transaction concurrently


at java.lang.Thread.run(Thread.java:748)**
Thu May 09 11:28:27 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:28:37 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:28:37 CEST 2019 LAST STEP 5

@@@@@@@@@@ TEST_JUNIT_INCLUSIVE_ASYNC
Thu May 09 11:31:02 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:31:02 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:31:05 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:31:05 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:31:05 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:31:12 CEST 2019 ASYNC Step3 - execution after sleep
11:31:12,264 [flowable-async-job-executor-thread-1] ERROR org.flowable.job.service.impl.asyncexecutor.DefaultAsyncRunnableExecutionExceptionHandler - Job 225 failed
org.flowable.common.engine.api.FlowableOptimisticLockingException: ProcessInstance[217] was updated by another transaction concurrently

at java.lang.Thread.run(Thread.java:748)

Thu May 09 11:31:22 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:31:32 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:31:32 CEST 2019 LAST STEP 5

@@@@@@@@@@ TEST_JUNIT_INCLUSIVE_ASYNC_EXCLUSIVE
Thu May 09 11:30:00 CEST 2019 ASYNC Step2 - execution before sleeping 3s
Thu May 09 11:30:00 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:30:03 CEST 2019 ASYNC Step2 - execution after sleep
Thu May 09 11:30:03 CEST 2019 ASYNC Step11 - before catch event
Thu May 09 11:30:03 CEST 2019 EVENT Step12 - ##### MESSAGE RECEIVED #####
Thu May 09 11:30:10 CEST 2019 ASYNC Step3 - execution after sleep
11:30:10,571 [flowable-async-job-executor-thread-1] ERROR org.flowable.job.service.impl.asyncexecutor.DefaultAsyncRunnableExecutionExceptionHandler - Job 162 failed
org.flowable.common.engine.api.FlowableOptimisticLockingException: ProcessInstance[154] was updated by another transaction concurrently

at java.lang.Thread.run(Thread.java:748)

Thu May 09 11:30:20 CEST 2019 ASYNC Step3 - execution before sleeping 10s
Thu May 09 11:30:30 CEST 2019 ASYNC Step3 - execution after sleep
Thu May 09 11:30:30 CEST 2019 LAST STEP 5

Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 210.093 sec

What is strange to me is that we do not get the same result with parallel and inclusive gateways.
With Parallel gateway, we have 2 scenarios without OptimisticLock exception.
But with Inclusive gateway, all scenarios generate an OptimisticLock exception!..
And it’s really problematic (to me at least :)).

I don’t know how to upload the project with the corresponding JUnit tests (and BPMN files) :frowning:

Best Regards
William.

Hi,
I add below the content of 1 BPMN: TEST_JUNIT_INCLUSIVE_ASYNC_EXCLUSIVE.bpmn20.xml

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef">
  <message id="EVENT_ID" name="EVENT_NAME"></message>
  <process id="TEST_JUNIT_INCLUSIVE_ASYNC_EXCLUSIVE" name="TEST_JUNIT_INCLUSIVE_ASYNC_EXCLUSIVE" isExecutable="true">
    <startEvent id="START"></startEvent>
    <sequenceFlow id="sid-72FBEAC8-8CA9-4F51-A9D6-6B25FA04B525" sourceRef="START" targetRef="GTW_0"></sequenceFlow>
    <scriptTask id="SCRIPT_11" name="Send data" flowable:async="true" flowable:exclusive="false" scriptFormat="groovy" flowable:autoStoreVariables="false">
      <script><![CDATA[println new Date().toString() + " ASYNC Step11 - before catch event"]]></script>
    </scriptTask>
    <scriptTask id="SCRIPT_2" name="Wait 3 seconds" flowable:async="true" flowable:exclusive="false" scriptFormat="groovy" flowable:autoStoreVariables="false">
      <script><![CDATA[println new Date().toString() + " ASYNC Step2 - execution before sleeping 3s"
sleep(3000)
println new Date().toString() + " ASYNC Step2 - execution after sleep"]]></script>
    </scriptTask>
    <scriptTask id="SCRIPT_3" name="Wait 10 seconds" flowable:async="true" flowable:exclusive="false" scriptFormat="groovy" flowable:autoStoreVariables="false">
      <script><![CDATA[println new Date().toString() + " ASYNC Step3 - execution before sleeping 10s"
sleep(10000)
println new Date().toString() + " ASYNC Step3 - execution after sleep"]]></script>
    </scriptTask>
    <sequenceFlow id="sid-AADE6550-5E38-42F7-BE68-6946C67B9E66" sourceRef="SCRIPT_3" targetRef="GTW_4"></sequenceFlow>
    <endEvent id="END"></endEvent>
    <intermediateCatchEvent id="ASYNC_EVENT" name="ASYNC_EVENT">
      <messageEventDefinition messageRef="EVENT_ID"></messageEventDefinition>
    </intermediateCatchEvent>
    <sequenceFlow id="sid-E0FE8E17-08E1-4D4E-AC49-D024BB548616" sourceRef="SCRIPT_11" targetRef="ASYNC_EVENT"></sequenceFlow>
    <scriptTask id="SCRIPT_12" name="Message received" scriptFormat="groovy" flowable:autoStoreVariables="false">
      <script><![CDATA[println new Date().toString() + " EVENT Step12 - ##### MESSAGE RECEIVED #####"]]></script>
    </scriptTask>
    <sequenceFlow id="sid-B006CF96-D592-4116-87A3-B15D3BE4A577" sourceRef="ASYNC_EVENT" targetRef="SCRIPT_12"></sequenceFlow>
    <sequenceFlow id="sid-0C96EA36-A68B-4609-8603-111A558DA7BA" sourceRef="SCRIPT_12" targetRef="GTW_4"></sequenceFlow>
    <sequenceFlow id="sid-79CC5977-E689-45C8-B599-783709B54E40" sourceRef="GTW_4" targetRef="SCRIPT_5"></sequenceFlow>
    <sequenceFlow id="sid-D674E2DF-CB33-487F-8C02-02C2BD084392" sourceRef="SCRIPT_5" targetRef="END"></sequenceFlow>
    <scriptTask id="SCRIPT_5" name="LAST STEP" scriptFormat="groovy" flowable:autoStoreVariables="false">
      <script><![CDATA[println new Date().toString() + " LAST STEP 5"
println ""]]></script>
    </scriptTask>
    <sequenceFlow id="sid-EC4E8D43-8EC0-4220-A195-5D27C562F4A7" sourceRef="SCRIPT_2" targetRef="GTW_4"></sequenceFlow>
    <inclusiveGateway id="GTW_0"></inclusiveGateway>
    <inclusiveGateway id="GTW_4" flowable:async="true"></inclusiveGateway>
    <sequenceFlow id="sid-6EED67D1-8690-4268-8ADB-34BAE38316B5" sourceRef="GTW_0" targetRef="SCRIPT_2">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${true}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="sid-9964B076-20B9-4CED-9CDD-4456C8CF984D" sourceRef="GTW_0" targetRef="SCRIPT_3">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${true}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="sid-5D900C78-0D4D-458D-B601-CC792D122A13" sourceRef="GTW_0" targetRef="SCRIPT_11">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${true}]]></conditionExpression>
    </sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_TEST_JUNIT_INCLUSIVE_ASYNC_EXCLUSIVE">
    <bpmndi:BPMNPlane bpmnElement="TEST_JUNIT_INCLUSIVE_ASYNC_EXCLUSIVE" id="BPMNPlane_TEST_JUNIT_INCLUSIVE_ASYNC_EXCLUSIVE">
      <bpmndi:BPMNShape bpmnElement="START" id="BPMNShape_START">
        <omgdc:Bounds height="30.0" width="30.0" x="60.0" y="163.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="SCRIPT_11" id="BPMNShape_SCRIPT_11">
        <omgdc:Bounds height="80.0" width="100.0" x="195.0" y="30.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="SCRIPT_2" id="BPMNShape_SCRIPT_2">
        <omgdc:Bounds height="80.0" width="100.0" x="195.0" y="138.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="SCRIPT_3" id="BPMNShape_SCRIPT_3">
        <omgdc:Bounds height="80.0" width="100.0" x="195.0" y="243.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="END" id="BPMNShape_END">
        <omgdc:Bounds height="28.0" width="28.0" x="735.0" y="164.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="ASYNC_EVENT" id="BPMNShape_ASYNC_EVENT">
        <omgdc:Bounds height="30.0" width="30.0" x="330.0" y="58.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="SCRIPT_12" id="BPMNShape_SCRIPT_12">
        <omgdc:Bounds height="80.0" width="100.0" x="405.0" y="33.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="SCRIPT_5" id="BPMNShape_SCRIPT_5">
        <omgdc:Bounds height="80.0" width="100.0" x="595.0" y="138.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="GTW_0" id="BPMNShape_GTW_0">
        <omgdc:Bounds height="40.0" width="40.0" x="120.0" y="158.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="GTW_4" id="BPMNShape_GTW_4">
        <omgdc:Bounds height="40.0" width="40.0" x="510.0" y="158.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-79CC5977-E689-45C8-B599-783709B54E40" id="BPMNEdge_sid-79CC5977-E689-45C8-B599-783709B54E40">
        <omgdi:waypoint x="549.5247370727428" y="178.41666666666663"></omgdi:waypoint>
        <omgdi:waypoint x="594.9999999999953" y="178.21812227074233"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-D674E2DF-CB33-487F-8C02-02C2BD084392" id="BPMNEdge_sid-D674E2DF-CB33-487F-8C02-02C2BD084392">
        <omgdi:waypoint x="694.9499999999563" y="178.0"></omgdi:waypoint>
        <omgdi:waypoint x="735.0" y="178.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-0C96EA36-A68B-4609-8603-111A558DA7BA" id="BPMNEdge_sid-0C96EA36-A68B-4609-8603-111A558DA7BA">
        <omgdi:waypoint x="504.95000000000005" y="73.0"></omgdi:waypoint>
        <omgdi:waypoint x="530.0" y="73.0"></omgdi:waypoint>
        <omgdi:waypoint x="530.0" y="158.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-72FBEAC8-8CA9-4F51-A9D6-6B25FA04B525" id="BPMNEdge_sid-72FBEAC8-8CA9-4F51-A9D6-6B25FA04B525">
        <omgdi:waypoint x="89.94948474567383" y="178.11411890132848"></omgdi:waypoint>
        <omgdi:waypoint x="120.34615384615299" y="178.34615384615384"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-AADE6550-5E38-42F7-BE68-6946C67B9E66" id="BPMNEdge_sid-AADE6550-5E38-42F7-BE68-6946C67B9E66">
        <omgdi:waypoint x="294.95000000000005" y="283.0"></omgdi:waypoint>
        <omgdi:waypoint x="530.0" y="283.0"></omgdi:waypoint>
        <omgdi:waypoint x="530.0" y="197.90946139180178"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-E0FE8E17-08E1-4D4E-AC49-D024BB548616" id="BPMNEdge_sid-E0FE8E17-08E1-4D4E-AC49-D024BB548616">
        <omgdi:waypoint x="294.94999999999993" y="71.4985"></omgdi:waypoint>
        <omgdi:waypoint x="330.0054582584413" y="72.55019845423215"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-B006CF96-D592-4116-87A3-B15D3BE4A577" id="BPMNEdge_sid-B006CF96-D592-4116-87A3-B15D3BE4A577">
        <omgdi:waypoint x="359.9499984899576" y="73.0"></omgdi:waypoint>
        <omgdi:waypoint x="405.0" y="73.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-6EED67D1-8690-4268-8ADB-34BAE38316B5" id="BPMNEdge_sid-6EED67D1-8690-4268-8ADB-34BAE38316B5">
        <omgdi:waypoint x="159.4357732732732" y="178.5"></omgdi:waypoint>
        <omgdi:waypoint x="194.99999999999338" y="178.5"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-9964B076-20B9-4CED-9CDD-4456C8CF984D" id="BPMNEdge_sid-9964B076-20B9-4CED-9CDD-4456C8CF984D">
        <omgdi:waypoint x="140.5" y="197.44094168260037"></omgdi:waypoint>
        <omgdi:waypoint x="140.5" y="283.0"></omgdi:waypoint>
        <omgdi:waypoint x="194.9999999999887" y="283.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-5D900C78-0D4D-458D-B601-CC792D122A13" id="BPMNEdge_sid-5D900C78-0D4D-458D-B601-CC792D122A13">
        <omgdi:waypoint x="140.49999999999997" y="158.5"></omgdi:waypoint>
        <omgdi:waypoint x="140.5" y="70.0"></omgdi:waypoint>
        <omgdi:waypoint x="195.0" y="70.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-EC4E8D43-8EC0-4220-A195-5D27C562F4A7" id="BPMNEdge_sid-EC4E8D43-8EC0-4220-A195-5D27C562F4A7">
        <omgdi:waypoint x="294.94999999988784" y="178.0"></omgdi:waypoint>
        <omgdi:waypoint x="510.0" y="178.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

Best Regards
William

And the Test file with the Test function associated to the BPMN above (may be adapted for other scenarios):

public class TestParallelGatewayCatchEvent {
    @Rule
    public FlowableRule flowableRule = new FlowableRule();
    static final String EVENT_NAME = "EVENT_NAME";
    /**
     * ############# INCLUSIVE GATEWAY TESTS ################
     * Use a 3 branches inclusive gateway with 1 branch with a catching message event.
     *    |--11-EVENT-12-|
     * 0-(O)-2----------(O)-5-0
     *    |--3-----------|
     * Script tasks 11, 2 & 3 are Async (and not Exclusive)
     * Script tasks 12 & 5 are Sync (and not Exclusive).
     **/
    
    /**
     * Both Async and Exclusive flags set on Join Gateway.
     */
    @Test
    @Deployment(resources = { "TEST_JUNIT_INCLUSIVE_ASYNC_EXCLUSIVE.bpmn20.xml" })
    public void requestApproved14_INCLUSIVE_ASYNC_EXCL() {

        System.out.println();
        System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
        System.out.println("@@@@@ TEST_JUNIT_INCLUSIVE_ASYNC_EXCLUSIVE ");

        RuntimeService runtimeService = flowableRule.getRuntimeService();
        IdentityService identityService = flowableRule.getIdentityService();

        // Create process instance
        ProcessInstance processInstance;
        try {
            identityService.setAuthenticatedUserId("admin");
            processInstance = runtimeService.startProcessInstanceByKey("TEST_JUNIT_INCLUSIVE_ASYNC_EXCLUSIVE");
        } finally {
            identityService.setAuthenticatedUserId(null);
        }

        Awaitility.await().atMost(1, TimeUnit.MINUTES).until(() -> {
            return (1 == runtimeService.createExecutionQuery().processInstanceId(processInstance.getId())
                    .messageEventSubscriptionName(EVENT_NAME).count());
        });

        Execution execution = runtimeService.createExecutionQuery()
            .processInstanceId(processInstance.getId())
            .messageEventSubscriptionName(EVENT_NAME)
            .singleResult();        
        
        runtimeService.messageEventReceived(EVENT_NAME, execution.getId());

        // Check that the process instance is finished
        Awaitility.await().atMost(1, TimeUnit.MINUTES).until(() -> {
            return (0 == runtimeService.createProcessInstanceQuery().count());
        });
    }}

Issue created: https://github.com/flowable/flowable-engine/issues/1741