Fork me on GitHub

小L 的个人博客

生活虽不能自由,但愿心能自由。

  menu
10 文章
0 评论
22116 浏览
0 当前访客
ღゝ◡╹)ノ❤️
生活虽不能自由,但愿心能自由

Boundary Events of Activiti 6.x Events

边界事件

边界事件是依附于一个活动的捕获事件类型,边界事件永远不会抛出。活动执行时,事件将监听某类型的触发器。当事件被捕获后,这个活动被中断并遵循这个边界事件的流向。

一个边界事件的定义包括

  • 唯一标识
  • 必须通过attachedToRef属性引用一个活动

边界事件包括:

1. 定时器边界事件

一个定时器边界时间事件在流程到达它依附的活动(人工任务、系统任务、子流程)时,一个定时器开始,当活动超过指定时间时,这个活动被中断。BPMN 2.0区分中断和不中断边界时间事件,默认开启中断。
Note: 只有当job或async executor开启(jobExecutorActivate或asyncExecutorActivate应该被设置为true)定时器边界事件会被触发。
已知问题:任何一个类型的边界事件,流出时,不能有多条序列流。 例如:

image.png

流程图:
image.png

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:activiti="http://activiti.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.activiti.org/processdef">
  <process id="BoundaryTimerProcess_1" name="定时边界事件" isExecutable="true">
    <startEvent id="startEvent1"></startEvent>
    <sequenceFlow id="sid-694B2173-BBA7-4808-9434-BA02CDA974E5" sourceRef="startEvent1" targetRef="sid-E225EBDE-CFA1-4162-8B6D-CC7ACC0C2ED8"></sequenceFlow>
    <endEvent id="sid-DAFAEFC4-C882-44E3-95FD-642A9CD143C2">
      <extensionElements>
        <activiti:executionListener event="end" expression="#{boundaryTimerEventExecutionListener.end(execution)}"></activiti:executionListener>
      </extensionElements>
    </endEvent>
    <sequenceFlow id="sid-42D1AE98-48D2-4E38-B8ED-7CE96400C090" sourceRef="sid-E225EBDE-CFA1-4162-8B6D-CC7ACC0C2ED8" targetRef="sid-DAFAEFC4-C882-44E3-95FD-642A9CD143C2"></sequenceFlow>
    <endEvent id="sid-0F1B4D5F-0709-4470-957F-E3101E3E05C4">
      <extensionElements>
        <activiti:executionListener event="end" expression="#{boundaryTimerEventExecutionListener.boundaryEnd(execution)}"></activiti:executionListener>
      </extensionElements>
    </endEvent>
    <userTask id="sid-E225EBDE-CFA1-4162-8B6D-CC7ACC0C2ED8" name="用户任务">
      <extensionElements>
        <activiti:executionListener event="start" expression="#{resumeService.boundaryTimerProcess2(execution)}"></activiti:executionListener>
      </extensionElements>
    </userTask>
    <boundaryEvent id="sid-153AC446-F91B-48D5-B1E2-E6C10CFA7BFA"
                   attachedToRef="sid-E225EBDE-CFA1-4162-8B6D-CC7ACC0C2ED8" cancelActivity="true">
      <timerEventDefinition>
        <timeDuration>PT2S</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>
    <sequenceFlow id="sid-FBB8ABF8-6323-41F8-99BF-CB5DB7115235" sourceRef="sid-153AC446-F91B-48D5-B1E2-E6C10CFA7BFA" targetRef="sid-0F1B4D5F-0709-4470-957F-E3101E3E05C4"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_BoundaryTimerProcess_1">
    <bpmndi:BPMNPlane bpmnElement="BoundaryTimerProcess_1" id="BPMNPlane_BoundaryTimerProcess_1">
      <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
        <omgdc:Bounds height="30.0" width="30.0" x="90.0" y="150.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-DAFAEFC4-C882-44E3-95FD-642A9CD143C2" id="BPMNShape_sid-DAFAEFC4-C882-44E3-95FD-642A9CD143C2">
        <omgdc:Bounds height="28.0" width="28.0" x="345.0" y="150.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-0F1B4D5F-0709-4470-957F-E3101E3E05C4" id="BPMNShape_sid-0F1B4D5F-0709-4470-957F-E3101E3E05C4">
        <omgdc:Bounds height="28.0" width="28.0" x="218.77855543777616" y="330.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-E225EBDE-CFA1-4162-8B6D-CC7ACC0C2ED8" id="BPMNShape_sid-E225EBDE-CFA1-4162-8B6D-CC7ACC0C2ED8">
        <omgdc:Bounds height="80.0" width="100.0" x="165.0" y="120.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-153AC446-F91B-48D5-B1E2-E6C10CFA7BFA" id="BPMNShape_sid-153AC446-F91B-48D5-B1E2-E6C10CFA7BFA">
        <omgdc:Bounds height="31.0" width="30.99999999999997" x="217.2785554377762" y="184.96153996183554"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-FBB8ABF8-6323-41F8-99BF-CB5DB7115235" id="BPMNEdge_sid-FBB8ABF8-6323-41F8-99BF-CB5DB7115235">
        <omgdi:waypoint x="233.2226267657081" y="216.9614422110257"></omgdi:waypoint>
        <omgdi:waypoint x="232.82749302583574" y="330.0000855319586"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-42D1AE98-48D2-4E38-B8ED-7CE96400C090" id="BPMNEdge_sid-42D1AE98-48D2-4E38-B8ED-7CE96400C090">
        <omgdi:waypoint x="265.0" y="160.0"></omgdi:waypoint>
        <omgdi:waypoint x="287.5" y="160.0"></omgdi:waypoint>
        <omgdi:waypoint x="287.5" y="164.0"></omgdi:waypoint>
        <omgdi:waypoint x="345.0" y="164.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-694B2173-BBA7-4808-9434-BA02CDA974E5" id="BPMNEdge_sid-694B2173-BBA7-4808-9434-BA02CDA974E5">
        <omgdi:waypoint x="120.0" y="165.0"></omgdi:waypoint>
        <omgdi:waypoint x="142.5" y="165.0"></omgdi:waypoint>
        <omgdi:waypoint x="142.5" y="160.0"></omgdi:waypoint>
        <omgdi:waypoint x="165.0" y="160.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

当执行到人工任务时,如果超过2s没有执行完成,则流程转向边界事件处理。如果边界事件没有开启中断活动,则当发生中断时,引擎重新开启一条流向边界事件的处理流程。当前流程依然还是在此活动上,可以继续完成该活动。

2. 信号边界事件

当执行到达信号边界事件依附的任务(人工任务、系统任务、子流程)时,引擎会创建一个捕获事件,在其依附的任务的生命周期内监听抛出信号。被触发后将产生中断,所依附的任务将被中断执行。
Note:可以设置该事件是否中断。

流程图:
image.png

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:activiti="http://activiti.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.activiti.org/processdef">
  <signal id="boundarySignal_1" name="boundarySignal"></signal>
  <process id="boundarySignalProcess_1" name="边界信号事件Test" isExecutable="true">
    <startEvent id="startEvent1"></startEvent>
    <userTask id="sid-3B903462-38E1-46E0-9F49-1942D11AA361">
      <extensionElements>
        <activiti:taskListener event="complete" expression="#{resumeService.boundarySignalProcess(execution)}"></activiti:taskListener>
      </extensionElements>
    </userTask>
    <endEvent id="sid-40905450-4317-493F-A568-89D9FC8418E8">
      <extensionElements>
        <activiti:executionListener event="end" expression="#{boundarySignalEventExecutionListener.boundaryNormalEnd(execution)}"></activiti:executionListener>
      </extensionElements>
    </endEvent>
    <sequenceFlow id="sid-B6B54C7B-F6DC-406D-A5D1-C27A44604D15" sourceRef="sid-3B903462-38E1-46E0-9F49-1942D11AA361" targetRef="sid-40905450-4317-493F-A568-89D9FC8418E8"></sequenceFlow>
    <boundaryEvent id="sid-184B75D0-859C-4BFF-A220-7BB8104B546D" attachedToRef="sid-3B903462-38E1-46E0-9F49-1942D11AA361" cancelActivity="true">
      <signalEventDefinition signalRef="boundarySignal_1"></signalEventDefinition>
    </boundaryEvent>
    <endEvent id="sid-1629CD21-27C8-45AE-BB00-CDC4CFAE2B00">
      <extensionElements>
        <activiti:executionListener event="end" expression="#{boundarySignalEventExecutionListener.boundaryTriggerSignalEnd(execution)}"></activiti:executionListener>
      </extensionElements>
    </endEvent>
    <sequenceFlow id="sid-410BCE60-36BD-4391-8FAB-EA7713248C62" sourceRef="sid-184B75D0-859C-4BFF-A220-7BB8104B546D" targetRef="sid-1629CD21-27C8-45AE-BB00-CDC4CFAE2B00"></sequenceFlow>
    <sequenceFlow id="sid-16762580-15CF-46F4-B72A-17ADBE8108E4" sourceRef="startEvent1" targetRef="sid-3B903462-38E1-46E0-9F49-1942D11AA361"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_boundarySignalProcess_1">
    <bpmndi:BPMNPlane bpmnElement="boundarySignalProcess_1" id="BPMNPlane_boundarySignalProcess_1">
      <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
        <omgdc:Bounds height="30.0" width="30.0" x="100.0" y="163.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-3B903462-38E1-46E0-9F49-1942D11AA361" id="BPMNShape_sid-3B903462-38E1-46E0-9F49-1942D11AA361">
        <omgdc:Bounds height="80.0" width="100.0" x="175.0" y="138.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-40905450-4317-493F-A568-89D9FC8418E8" id="BPMNShape_sid-40905450-4317-493F-A568-89D9FC8418E8">
        <omgdc:Bounds height="28.0" width="28.0" x="320.0" y="164.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-184B75D0-859C-4BFF-A220-7BB8104B546D" id="BPMNShape_sid-184B75D0-859C-4BFF-A220-7BB8104B546D">
        <omgdc:Bounds height="30.0" width="30.0" x="225.0" y="203.62305335668174"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-1629CD21-27C8-45AE-BB00-CDC4CFAE2B00" id="BPMNShape_sid-1629CD21-27C8-45AE-BB00-CDC4CFAE2B00">
        <omgdc:Bounds height="28.0" width="28.0" x="226.0" y="300.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-410BCE60-36BD-4391-8FAB-EA7713248C62" id="BPMNEdge_sid-410BCE60-36BD-4391-8FAB-EA7713248C62">
        <omgdi:waypoint x="240.0" y="233.62305335668174"></omgdi:waypoint>
        <omgdi:waypoint x="240.0" y="300.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-16762580-15CF-46F4-B72A-17ADBE8108E4" id="BPMNEdge_sid-16762580-15CF-46F4-B72A-17ADBE8108E4">
        <omgdi:waypoint x="130.0" y="178.0"></omgdi:waypoint>
        <omgdi:waypoint x="175.0" y="178.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-B6B54C7B-F6DC-406D-A5D1-C27A44604D15" id="BPMNEdge_sid-B6B54C7B-F6DC-406D-A5D1-C27A44604D15">
        <omgdi:waypoint x="275.0" y="178.0"></omgdi:waypoint>
        <omgdi:waypoint x="320.0" y="178.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

当流程实例执行到信号边界事件依附的活动上时,在该活动的生命周期内,边界信号事件将捕获对应的信号,被触发后,继续执行边界事件的下一步流程。如果中断开启,则该活动所在流程实例被终止。否则,可以继续完成该活动。

3. 消息边界事件

当执行到达消息边界事件依附的活动(人工任务、系统任务、子流程)时,引擎会创建一个捕获事件,在其依附的活动的生命周期等待抛出消息。被触发后,执行边界事件的后续处理流程。如果边界事件设置为中断,该任务则被中断执行。

流程图:

image.png

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:activiti="http://activiti.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.activiti.org/processdef">
  <message id="boundMessage_1" name="boundMessage"></message>
  <process id="boundaryMessageProcess_1" name="边界消息事件" isExecutable="true">
    <startEvent id="startEvent1"></startEvent>
    <userTask id="sid-72070958-EFCC-49C5-B894-433548482AF5">
      <extensionElements>
        <activiti:taskListener event="complete" expression="#{resumeService.boundaryMessageProcess(execution)}"></activiti:taskListener>
      </extensionElements>
    </userTask>
    <sequenceFlow id="sid-2B1DE00C-5D28-490D-8F64-78F42D113E95" sourceRef="startEvent1" targetRef="sid-72070958-EFCC-49C5-B894-433548482AF5"></sequenceFlow>
    <endEvent id="sid-A45BAB70-1DA0-4E6B-91E9-D5975E0BA705">
      <extensionElements>
        <activiti:executionListener event="end" expression="#{boundaryMessageExecutionListener.boundaryMessageNoramlEnd(execution)}"></activiti:executionListener>
      </extensionElements>
    </endEvent>
    <sequenceFlow id="sid-1DD9BD7B-4A42-4805-9161-55FA22E4C918" sourceRef="sid-72070958-EFCC-49C5-B894-433548482AF5" targetRef="sid-A45BAB70-1DA0-4E6B-91E9-D5975E0BA705"></sequenceFlow>
    <boundaryEvent id="sid-04F7340D-1F88-49F2-92AC-65AB257B9515"
                   attachedToRef="sid-72070958-EFCC-49C5-B894-433548482AF5" cancelActivity="true">
      <messageEventDefinition messageRef="boundMessage_1"></messageEventDefinition>
    </boundaryEvent>
    <endEvent id="sid-E853057E-90C5-4602-A8E4-ECF3ADC75829">
      <extensionElements>
        <activiti:executionListener event="end" expression="#{boundaryMessageExecutionListener.boundaryMessageBoundaryEnd(execution)}"></activiti:executionListener>
      </extensionElements>
    </endEvent>
    <sequenceFlow id="sid-B02D8EAA-60AE-41C4-A5A7-C3816A3BCD31" sourceRef="sid-04F7340D-1F88-49F2-92AC-65AB257B9515" targetRef="sid-E853057E-90C5-4602-A8E4-ECF3ADC75829"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_boundaryMessageProcess_1">
    <bpmndi:BPMNPlane bpmnElement="boundaryMessageProcess_1" id="BPMNPlane_boundaryMessageProcess_1">
      <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
        <omgdc:Bounds height="30.0" width="30.0" x="75.0" y="145.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-72070958-EFCC-49C5-B894-433548482AF5" id="BPMNShape_sid-72070958-EFCC-49C5-B894-433548482AF5">
        <omgdc:Bounds height="80.0" width="100.0" x="165.0" y="120.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-A45BAB70-1DA0-4E6B-91E9-D5975E0BA705" id="BPMNShape_sid-A45BAB70-1DA0-4E6B-91E9-D5975E0BA705">
        <omgdc:Bounds height="28.0" width="28.0" x="315.0" y="146.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-04F7340D-1F88-49F2-92AC-65AB257B9515" id="BPMNShape_sid-04F7340D-1F88-49F2-92AC-65AB257B9515">
        <omgdc:Bounds height="30.0" width="30.0" x="200.0" y="180.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-E853057E-90C5-4602-A8E4-ECF3ADC75829" id="BPMNShape_sid-E853057E-90C5-4602-A8E4-ECF3ADC75829">
        <omgdc:Bounds height="28.0" width="28.0" x="201.0" y="270.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-B02D8EAA-60AE-41C4-A5A7-C3816A3BCD31" id="BPMNEdge_sid-B02D8EAA-60AE-41C4-A5A7-C3816A3BCD31">
        <omgdi:waypoint x="215.0" y="210.0"></omgdi:waypoint>
        <omgdi:waypoint x="215.0" y="270.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-2B1DE00C-5D28-490D-8F64-78F42D113E95" id="BPMNEdge_sid-2B1DE00C-5D28-490D-8F64-78F42D113E95">
        <omgdi:waypoint x="105.0" y="160.0"></omgdi:waypoint>
        <omgdi:waypoint x="165.0" y="160.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-1DD9BD7B-4A42-4805-9161-55FA22E4C918" id="BPMNEdge_sid-1DD9BD7B-4A42-4805-9161-55FA22E4C918">
        <omgdi:waypoint x="265.0" y="160.0"></omgdi:waypoint>
        <omgdi:waypoint x="315.0" y="160.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

当流程实例执行到边界消息时间依附的活动上时,在该活动的生命周期内,边界事件将捕获对应的消息,被触发后,继续执行边界事件的下一步流程。如果中断开启,则该活动所在流程实例被终止。否则,可以继续完成该活动。

4. 取消边界事件

取消边界事件依附在事务子流程的边界,触发取消边界事件时,首先中断当前作用域活动的所有执行,然后开始补偿所有有效的补偿边界事件。同步执行补偿,在离开事务之前,取消边界事件会一直等待补偿边界事件完成。补偿完成时,执行取消边界事件下一步序列流。
Note:
1. 事务子流程只允许一个取消边界事件。
2. 如果子流程内嵌套子流程,则只对已成功完成的子流程进行补偿。
3. 如果依附在事务子流程的取消边界事件是多实例的。那么一个实例触发取消,则边界事件将取消所有实例。

流程图:
image.png

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:activiti="http://activiti.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.activiti.org/processdef">
    <process id="CancelEndProcess_1" name="取消结束事件" isExecutable="true">
        <startEvent id="startEvent1"></startEvent>
        <transaction id="sid-B2B06A0C-8AC5-42E0-AE37-F1D320C00481" name="subProcess">
            <startEvent id="sid-69ED923E-EAC9-477B-B43D-9545AA4BBE84"></startEvent>
            <endEvent id="sid-BFEEEF61-4D67-4E32-831D-99BA3B0DE262">
                <extensionElements>
                    <activiti:executionListener event="end"
                                                expression="#{cancelEndEventExecutionListener.cancelSubEnd(execution)}"></activiti:executionListener>
                </extensionElements>
                <cancelEventDefinition></cancelEventDefinition>
            </endEvent>
            <serviceTask id="sid-A7CBED9F-DF74-4B56-8369-A8F3A64E8CCD"
                         activiti:expression="#{resumeService.cancelEndSubServiceProcess(execution)}"></serviceTask>
            <boundaryEvent id="sid-FE36516E-FD58-487D-8FE9-AE0D34324825"
                           attachedToRef="sid-A7CBED9F-DF74-4B56-8369-A8F3A64E8CCD" cancelActivity="false">
                <compensateEventDefinition waitForCompletion="false"></compensateEventDefinition>
            </boundaryEvent>
            <serviceTask id="sid-647097DE-7815-4B87-BD90-57D865CB1E5D" isForCompensation="true"
                         activiti:expression="#{resumeService.cancelEndSubBoundaryProcess(execution)}"></serviceTask>
            <sequenceFlow id="sid-40141D14-7DC9-427C-800B-5DE889F5CE3E"
                          sourceRef="sid-69ED923E-EAC9-477B-B43D-9545AA4BBE84"
                          targetRef="sid-A7CBED9F-DF74-4B56-8369-A8F3A64E8CCD"></sequenceFlow>
            <sequenceFlow id="sid-7366D581-B8AC-482E-A4EE-34124DEEA81D"
                          sourceRef="sid-A7CBED9F-DF74-4B56-8369-A8F3A64E8CCD"
                          targetRef="sid-BFEEEF61-4D67-4E32-831D-99BA3B0DE262"></sequenceFlow>
        </transaction>
        <endEvent id="sid-8C6D796D-D86F-40F7-9D5D-E29184542898">
            <extensionElements>
                <activiti:executionListener event="end"
                                            expression="#{cancelEndEventExecutionListener.cancelNormalEnd(execution)}"></activiti:executionListener>
            </extensionElements>
        </endEvent>
        <endEvent id="sid-87BBAC4B-CDDA-4CDC-A881-D43B0FEC3F2E">
            <extensionElements>
                <activiti:executionListener event="end"
                                            expression="#{cancelEndEventExecutionListener.cancelBoundaryEnd(execution)}"></activiti:executionListener>
            </extensionElements>
        </endEvent>
        <boundaryEvent id="sid-01EAC883-48A4-4F39-87D9-6CC2C0CB4CE2"
                       attachedToRef="sid-B2B06A0C-8AC5-42E0-AE37-F1D320C00481" cancelActivity="false">
            <cancelEventDefinition></cancelEventDefinition>
        </boundaryEvent>
        <sequenceFlow id="sid-FA91BD57-6EA9-4649-BF60-B3784C4938CF" sourceRef="sid-01EAC883-48A4-4F39-87D9-6CC2C0CB4CE2"
                      targetRef="sid-87BBAC4B-CDDA-4CDC-A881-D43B0FEC3F2E"></sequenceFlow>
        <sequenceFlow id="sid-0E54E157-3396-46A9-8855-DC01ACFFCF0B" sourceRef="sid-B2B06A0C-8AC5-42E0-AE37-F1D320C00481"
                      targetRef="sid-8C6D796D-D86F-40F7-9D5D-E29184542898"></sequenceFlow>
        <serviceTask id="sid-3016994B-2E77-4413-B711-A8D1897D1F56" name="顺序任务"
                     activiti:expression="#{resumeService.cancelSequenceProcess(execution)}"></serviceTask>
        <sequenceFlow id="sid-BD6A4270-A762-4735-B3E4-017C7A0C166F" sourceRef="sid-3016994B-2E77-4413-B711-A8D1897D1F56"
                      targetRef="sid-B2B06A0C-8AC5-42E0-AE37-F1D320C00481"></sequenceFlow>
        <sequenceFlow id="sid-144C5A96-47C5-499A-B862-A04A501A1B2A" sourceRef="startEvent1"
                      targetRef="sid-3016994B-2E77-4413-B711-A8D1897D1F56"></sequenceFlow>
        <boundaryEvent id="sid-7CBAB2F0-6C83-402C-9129-8CE057F8BC9F"
                       attachedToRef="sid-3016994B-2E77-4413-B711-A8D1897D1F56" cancelActivity="false">
            <compensateEventDefinition waitForCompletion="false"></compensateEventDefinition>
        </boundaryEvent>
        <serviceTask id="sid-4E925047-C390-49C8-8C44-1B969FF96ED4" isForCompensation="true"
                     activiti:expression="#{resumeService.cancelSequenceEndProcess(execution)}"></serviceTask>
        <association id="sid-2C7498B2-7CAA-4D92-A03E-0EB406AE6B16" sourceRef="sid-FE36516E-FD58-487D-8FE9-AE0D34324825"
                     targetRef="sid-647097DE-7815-4B87-BD90-57D865CB1E5D" associationDirection="None"></association>
        <association id="sid-4A3FBD2A-CE42-4AFA-B9CE-7C82E2D36044" sourceRef="sid-7CBAB2F0-6C83-402C-9129-8CE057F8BC9F"
                     targetRef="sid-4E925047-C390-49C8-8C44-1B969FF96ED4" associationDirection="None"></association>
    </process>
    <bpmndi:BPMNDiagram id="BPMNDiagram_CancelEndProcess_1">
        <bpmndi:BPMNPlane bpmnElement="CancelEndProcess_1" id="BPMNPlane_CancelEndProcess_1">
            <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
                <omgdc:Bounds height="30.0" width="30.0" x="0.0" y="191.5"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="sid-B2B06A0C-8AC5-42E0-AE37-F1D320C00481"
                              id="BPMNShape_sid-B2B06A0C-8AC5-42E0-AE37-F1D320C00481">
                <omgdc:Bounds height="263.0" width="386.0" x="450.0" y="75.0"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="sid-69ED923E-EAC9-477B-B43D-9545AA4BBE84"
                              id="BPMNShape_sid-69ED923E-EAC9-477B-B43D-9545AA4BBE84">
                <omgdc:Bounds height="30.0" width="30.0" x="465.0" y="157.5"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="sid-BFEEEF61-4D67-4E32-831D-99BA3B0DE262"
                              id="BPMNShape_sid-BFEEEF61-4D67-4E32-831D-99BA3B0DE262">
                <omgdc:Bounds height="28.0" width="28.0" x="660.0" y="150.0"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="sid-A7CBED9F-DF74-4B56-8369-A8F3A64E8CCD"
                              id="BPMNShape_sid-A7CBED9F-DF74-4B56-8369-A8F3A64E8CCD">
                <omgdc:Bounds height="80.0" width="100.0" x="525.0" y="120.0"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="sid-FE36516E-FD58-487D-8FE9-AE0D34324825"
                              id="BPMNShape_sid-FE36516E-FD58-487D-8FE9-AE0D34324825">
                <omgdc:Bounds height="30.0" width="30.0" x="555.7745898324266" y="185.6695728628938"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="sid-647097DE-7815-4B87-BD90-57D865CB1E5D"
                              id="BPMNShape_sid-647097DE-7815-4B87-BD90-57D865CB1E5D">
                <omgdc:Bounds height="40.0" width="69.0" x="540.0" y="255.0"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="sid-8C6D796D-D86F-40F7-9D5D-E29184542898"
                              id="BPMNShape_sid-8C6D796D-D86F-40F7-9D5D-E29184542898">
                <omgdc:Bounds height="28.0" width="28.0" x="915.0" y="192.5"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="sid-87BBAC4B-CDDA-4CDC-A881-D43B0FEC3F2E"
                              id="BPMNShape_sid-87BBAC4B-CDDA-4CDC-A881-D43B0FEC3F2E">
                <omgdc:Bounds height="28.0" width="28.0" x="721.490614257695" y="495.0"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="sid-01EAC883-48A4-4F39-87D9-6CC2C0CB4CE2"
                              id="BPMNShape_sid-01EAC883-48A4-4F39-87D9-6CC2C0CB4CE2">
                <omgdc:Bounds height="30.0" width="30.0" x="720.490614257695" y="323.6349699762076"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="sid-2C7498B2-7CAA-4D92-A03E-0EB406AE6B16"
                              id="BPMNShape_sid-2C7498B2-7CAA-4D92-A03E-0EB406AE6B16">
                <omgdc:Bounds height="38.071253128785116" width="1.90811541061953" x="571.5522657596997"
                              y="216.18598078801546"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="sid-3016994B-2E77-4413-B711-A8D1897D1F56"
                              id="BPMNShape_sid-3016994B-2E77-4413-B711-A8D1897D1F56">
                <omgdc:Bounds height="80.0" width="100.0" x="150.0" y="166.5"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="sid-7CBAB2F0-6C83-402C-9129-8CE057F8BC9F"
                              id="BPMNShape_sid-7CBAB2F0-6C83-402C-9129-8CE057F8BC9F">
                <omgdc:Bounds height="30.0" width="30.0" x="165.0" y="231.72287342309488"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="sid-4A3FBD2A-CE42-4AFA-B9CE-7C82E2D36044"
                              id="BPMNShape_sid-4A3FBD2A-CE42-4AFA-B9CE-7C82E2D36044">
                <omgdc:Bounds height="52.13856328845259" width="0.0" x="180.0" y="262.10342929659004"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="sid-4E925047-C390-49C8-8C44-1B969FF96ED4"
                              id="BPMNShape_sid-4E925047-C390-49C8-8C44-1B969FF96ED4">
                <omgdc:Bounds height="80.0" width="100.0" x="130.0" y="315.0"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNEdge bpmnElement="sid-FA91BD57-6EA9-4649-BF60-B3784C4938CF"
                             id="BPMNEdge_sid-FA91BD57-6EA9-4649-BF60-B3784C4938CF">
                <omgdi:waypoint x="735.490614257695" y="353.63496997620757"></omgdi:waypoint>
                <omgdi:waypoint x="735.490614257695" y="495.0"></omgdi:waypoint>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge bpmnElement="sid-40141D14-7DC9-427C-800B-5DE889F5CE3E"
                             id="BPMNEdge_sid-40141D14-7DC9-427C-800B-5DE889F5CE3E">
                <omgdi:waypoint x="494.8718144331382" y="170.54318231142918"></omgdi:waypoint>
                <omgdi:waypoint x="525.0" y="166.57894736842104"></omgdi:waypoint>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge bpmnElement="sid-BD6A4270-A762-4735-B3E4-017C7A0C166F"
                             id="BPMNEdge_sid-BD6A4270-A762-4735-B3E4-017C7A0C166F">
                <omgdi:waypoint x="250.0" y="206.5"></omgdi:waypoint>
                <omgdi:waypoint x="450.0" y="206.5"></omgdi:waypoint>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge bpmnElement="sid-4A3FBD2A-CE42-4AFA-B9CE-7C82E2D36044"
                             id="BPMNEdge_sid-4A3FBD2A-CE42-4AFA-B9CE-7C82E2D36044">
                <omgdi:waypoint x="180.0" y="261.7228734230949"></omgdi:waypoint>
                <omgdi:waypoint x="180.0" y="315.0"></omgdi:waypoint>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge bpmnElement="sid-2C7498B2-7CAA-4D92-A03E-0EB406AE6B16"
                             id="BPMNEdge_sid-2C7498B2-7CAA-4D92-A03E-0EB406AE6B16">
                <omgdi:waypoint x="571.5254411412125" y="215.6507684864779"></omgdi:waypoint>
                <omgdi:waypoint x="573.4976082982271" y="255.0"></omgdi:waypoint>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge bpmnElement="sid-0E54E157-3396-46A9-8855-DC01ACFFCF0B"
                             id="BPMNEdge_sid-0E54E157-3396-46A9-8855-DC01ACFFCF0B">
                <omgdi:waypoint x="836.0" y="206.5"></omgdi:waypoint>
                <omgdi:waypoint x="915.0" y="206.5"></omgdi:waypoint>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge bpmnElement="sid-7366D581-B8AC-482E-A4EE-34124DEEA81D"
                             id="BPMNEdge_sid-7366D581-B8AC-482E-A4EE-34124DEEA81D">
                <omgdi:waypoint x="625.0" y="162.02020202020202"></omgdi:waypoint>
                <omgdi:waypoint x="660.0114134330599" y="163.43480458315395"></omgdi:waypoint>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge bpmnElement="sid-144C5A96-47C5-499A-B862-A04A501A1B2A"
                             id="BPMNEdge_sid-144C5A96-47C5-499A-B862-A04A501A1B2A">
                <omgdi:waypoint x="30.0" y="206.5"></omgdi:waypoint>
                <omgdi:waypoint x="150.0" y="206.5"></omgdi:waypoint>
            </bpmndi:BPMNEdge>
        </bpmndi:BPMNPlane>
    </bpmndi:BPMNDiagram>
</definitions>

5. 错误边界事件

错误边界事件一般和子流程或调用活动使用,因为子流程会为子流程内的活动创建范围,子流程内的错误结束事件引发错误,这样的错误会传递的父作用域,找到与其匹配的错误边界事件。当捕获错误事件时,边界任务绑定的节点就会销毁,也会停止范围内所有活动执行,然后继续执行错误边界事件输出序列流。

Note:错误结束事件和错误边界事件需要一起使用,错误结束事件触发错误边界事件,错误边界事件捕获错误结
束事件抛出的错误信息。

流程图:
image.png

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:activiti="http://activiti.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.activiti.org/processdef">
  <error id="errorEnd" name="errorEnd" errorCode="103"/>
  <process id="ErrorEndProcess_1" name="错误结束事件" isExecutable="true">
    <startEvent id="startEvent1"></startEvent>
    <subProcess id="sid-48B1B4EA-5685-4C38-9B34-9CE5A0C7E348" name="subProcess">
      <startEvent id="sid-2CE86EBD-DF22-4F01-8645-D90463BD0D1D"></startEvent>
      <endEvent id="sid-2D28F6C3-1CD5-4A8A-BC52-5B659C31B1D9">
        <errorEventDefinition />
      </endEvent>
      <sequenceFlow id="sid-E5394360-75DF-4734-8648-DB9485D035DA" sourceRef="sid-2CE86EBD-DF22-4F01-8645-D90463BD0D1D" targetRef="sid-2D28F6C3-1CD5-4A8A-BC52-5B659C31B1D9"></sequenceFlow>
    </subProcess>
    <sequenceFlow id="sid-D39A4224-B4DD-4671-AEF4-98D5B64F6B7A" sourceRef="startEvent1" targetRef="sid-48B1B4EA-5685-4C38-9B34-9CE5A0C7E348"></sequenceFlow>
    <endEvent id="sid-44064B37-B332-4DD7-BDB2-9A7B8DA5744E">
      <extensionElements>
        <activiti:executionListener event="end" expression="#{errorEndEventExecutionListener.errorEnd(execution)}"></activiti:executionListener>
      </extensionElements>
    </endEvent>
    <sequenceFlow id="sid-47A44E90-629B-47B1-A447-0A68ACDEF797" sourceRef="sid-48B1B4EA-5685-4C38-9B34-9CE5A0C7E348" targetRef="sid-44064B37-B332-4DD7-BDB2-9A7B8DA5744E"></sequenceFlow>
    <boundaryEvent id="sid-B67FF311-154C-42D7-9DAD-484C13F83F59" attachedToRef="sid-48B1B4EA-5685-4C38-9B34-9CE5A0C7E348">
      <errorEventDefinition errorRef="errorEnd"/>
    </boundaryEvent>
    <endEvent id="sid-00163599-296A-4CBB-AEF8-D8A64CB6FF1F">
      <extensionElements>
        <activiti:executionListener event="end" expression="#{errorEndEventExecutionListener.errorBoundaryEnd(execution)}"></activiti:executionListener>
      </extensionElements>
    </endEvent>
    <sequenceFlow id="sid-79959548-646D-4688-96F0-6CE312ECD1A9" sourceRef="sid-B67FF311-154C-42D7-9DAD-484C13F83F59" targetRef="sid-00163599-296A-4CBB-AEF8-D8A64CB6FF1F"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_ErrorEndProcess_1">
    <bpmndi:BPMNPlane bpmnElement="ErrorEndProcess_1" id="BPMNPlane_ErrorEndProcess_1">
      <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
        <omgdc:Bounds height="30.0" width="30.0" x="90.0" y="165.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-48B1B4EA-5685-4C38-9B34-9CE5A0C7E348" id="BPMNShape_sid-48B1B4EA-5685-4C38-9B34-9CE5A0C7E348">
        <omgdc:Bounds height="160.0" width="200.0" x="180.0" y="100.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-2CE86EBD-DF22-4F01-8645-D90463BD0D1D" id="BPMNShape_sid-2CE86EBD-DF22-4F01-8645-D90463BD0D1D">
        <omgdc:Bounds height="30.0" width="30.0" x="213.5" y="165.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-2D28F6C3-1CD5-4A8A-BC52-5B659C31B1D9" id="BPMNShape_sid-2D28F6C3-1CD5-4A8A-BC52-5B659C31B1D9">
        <omgdc:Bounds height="28.0" width="28.0" x="288.75" y="166.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-44064B37-B332-4DD7-BDB2-9A7B8DA5744E" id="BPMNShape_sid-44064B37-B332-4DD7-BDB2-9A7B8DA5744E">
        <omgdc:Bounds height="28.0" width="28.0" x="495.0" y="166.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-B67FF311-154C-42D7-9DAD-484C13F83F59" id="BPMNShape_sid-B67FF311-154C-42D7-9DAD-484C13F83F59">
        <omgdc:Bounds height="30.0" width="30.0" x="240.0" y="245.15895125748165"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-00163599-296A-4CBB-AEF8-D8A64CB6FF1F" id="BPMNShape_sid-00163599-296A-4CBB-AEF8-D8A64CB6FF1F">
        <omgdc:Bounds height="28.0" width="28.0" x="241.0" y="330.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-E5394360-75DF-4734-8648-DB9485D035DA" id="BPMNEdge_sid-E5394360-75DF-4734-8648-DB9485D035DA">
        <omgdi:waypoint x="243.5" y="180.0"></omgdi:waypoint>
        <omgdi:waypoint x="288.75" y="180.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-47A44E90-629B-47B1-A447-0A68ACDEF797" id="BPMNEdge_sid-47A44E90-629B-47B1-A447-0A68ACDEF797">
        <omgdi:waypoint x="380.0" y="180.0"></omgdi:waypoint>
        <omgdi:waypoint x="495.0" y="180.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-D39A4224-B4DD-4671-AEF4-98D5B64F6B7A" id="BPMNEdge_sid-D39A4224-B4DD-4671-AEF4-98D5B64F6B7A">
        <omgdi:waypoint x="120.0" y="180.0"></omgdi:waypoint>
        <omgdi:waypoint x="180.0" y="180.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-79959548-646D-4688-96F0-6CE312ECD1A9" id="BPMNEdge_sid-79959548-646D-4688-96F0-6CE312ECD1A9">
        <omgdi:waypoint x="255.0" y="275.15895125748165"></omgdi:waypoint>
        <omgdi:waypoint x="255.0" y="330.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

6. 补偿边界事件

补偿边界事件必须使用定向关联引用单个补偿处理程序。补偿边界事件在附加的活动成功完成激活。此时,创建对补偿事件的相应订阅。在触发补偿事件或相应的流程实例结束时,将删除订阅。
触发补偿时,与补偿边界事件关联的补偿处理程序的调用次数与成功完成的活动的次数相同。

流程图:
ThrowCompensateEventProcess_1.png

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:activiti="http://activiti.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.activiti.org/test">
  <process id="throwCompensationProcess_1" name="throwCompensationProcess_1" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="servicetask1" name="自动处理" activiti:expression="#{resumeService.throwCompensationProcess1(execution)}">
      <multiInstanceLoopCharacteristics isSequential="true">
        <loopCardinality>3</loopCardinality>
      </multiInstanceLoopCharacteristics>
    </serviceTask>
    <intermediateThrowEvent id="compensationintermediatethrowevent1" name="CompensationThrowingEvent">
      <compensateEventDefinition waitForCompletion="true"></compensateEventDefinition>
    </intermediateThrowEvent>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" sourceRef="compensationintermediatethrowevent1" targetRef="endevent1"></sequenceFlow>
    <sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="compensationintermediatethrowevent1"></sequenceFlow>
    <sequenceFlow id="flow3" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
    <serviceTask id="servicetask2" name="补偿程序"
                 activiti:expression="#{resumeService.throwCompensationProcess2(execution)}" isForCompensation="true"></serviceTask>
    <endEvent id="endevent2" name="End"></endEvent>
    <sequenceFlow id="flow4" sourceRef="servicetask2" targetRef="endevent2"></sequenceFlow>
    <boundaryEvent id="boundarycompensation1" name="Compensate" attachedToRef="servicetask1" cancelActivity="true">
      <compensateEventDefinition waitForCompletion="true"/>
    </boundaryEvent>
    <association id="association1" sourceRef="boundarycompensation1" targetRef="servicetask2" associationDirection="None"></association>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_throwCompensationProcess_1">
    <bpmndi:BPMNPlane bpmnElement="throwCompensationProcess_1" id="BPMNPlane_throwCompensationProcess_1">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="30.0" width="30.0" x="190.0" y="210.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1">
        <omgdc:Bounds height="55.0" width="105.0" x="285.0" y="200.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="compensationintermediatethrowevent1" id="BPMNShape_compensationintermediatethrowevent1">
        <omgdc:Bounds height="30.0" width="30.0" x="450.0" y="210.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="28.0" width="28.0" x="530.0" y="210.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="servicetask2" id="BPMNShape_servicetask2">
        <omgdc:Bounds height="55.0" width="105.0" x="290.0" y="333.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent2" id="BPMNShape_endevent2">
        <omgdc:Bounds height="28.0" width="28.0" x="325.0" y="440.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="association1" id="BPMNShape_association1">
        <omgdc:Bounds height="62.29863621192561" width="8.327832078669417" x="334.1721679213306" y="270.7013637880744"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="boundarycompensation1" id="BPMNShape_boundarycompensation1">
        <omgdc:Bounds height="30.0" width="30.0" x="317.08728677218915" y="240.10483746183536"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="association1" id="BPMNEdge_association1">
        <omgdi:waypoint x="334.07474805609303" y="269.972587716833"></omgdi:waypoint>
        <omgdi:waypoint x="342.5" y="333.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="479.9987984139044" y="224.81014179222905"></omgdi:waypoint>
        <omgdi:waypoint x="530.0011214803559" y="224.17720099391957"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="390.0" y="226.47058823529412"></omgdi:waypoint>
        <omgdi:waypoint x="450.0028826751491" y="225.2940611240167"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="219.99733072335283" y="225.2829685042142"></omgdi:waypoint>
        <omgdi:waypoint x="285.0" y="226.50943396226415"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="341.47058823529414" y="388.0"></omgdi:waypoint>
        <omgdi:waypoint x="339.52369738641573" y="440.00979839146476"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

生活虽不能自由,但愿心能自由。
评论