flowable-流程中心设计之开始事件(三)


简介

开始事件用来指明流程在哪里开始,分为空开始事件,消息开始事件,信号开始事件,定时器开始事件,错误开始事件。

  这里记录一个误区:       大多时候都是先有业务再根据业务code启动流程,流程办理过程中根据流程绑定的业务单号修改业务单号状态       我们也可以先有流程,流程办理跳到配置的办理页面,然后生成业务单号与流程建立关系,然后再根据流程编号根据业务单号与流程绑定关系修改业务单号状态       这里就体现了定时开始事件、信号开始事件、消息开始事件的作用了

空开始事件

说明

空开始事件意味着没有指定启动流程实例的触发条件。需要手动触发

         processEngine.getRuntimeService().startProcessInstanceByKey("流程定义key");

设计

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">
  <process id="tes_flow" name="tes_flow" isExecutable="true">
    <documentation>tes_flowdocumentation>
    <startEvent id="startEvent1">startEvent>
    <userTask id="sid-0C834D81-78B6-4A0F-B9FD-60B2063A1D72" name="第一审核人" flowable:assignee="1126">
      <extensionElements>
        <flowable:executionListener event="start">flowable:executionListener>
        <modeler:activiti-idm-assignee xmlns:modeler="http://flowable.org/modeler">true]]>modeler:activiti-idm-assignee>
        <modeler:assignee-info-email xmlns:modeler="http://flowable.org/modeler">13128273410]]>modeler:assignee-info-email>
        <modeler:assignee-info-firstname xmlns:modeler="http://flowable.org/modeler">李强]]>modeler:assignee-info-firstname>
        <modeler:assignee-info-lastname xmlns:modeler="http://flowable.org/modeler">李强]]>modeler:assignee-info-lastname>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler">false]]>modeler:initiator-can-complete>
      extensionElements>
    userTask>
    <sequenceFlow id="sid-B984EF00-0BAF-4629-8A93-28C9BE1A7390" sourceRef="startEvent1" targetRef="sid-0C834D81-78B6-4A0F-B9FD-60B2063A1D72">sequenceFlow>
    <endEvent id="sid-389474D7-E2B6-4E26-B2C0-28B8EFFF9DA8">
      <extensionElements>
        <flowable:executionListener event="end">flowable:executionListener>
      extensionElements>
    endEvent>
    <sequenceFlow id="sid-4E62474A-57C3-4B99-8BD6-ABEC2B0B126A" sourceRef="sid-0C834D81-78B6-4A0F-B9FD-60B2063A1D72" targetRef="sid-389474D7-E2B6-4E26-B2C0-28B8EFFF9DA8">sequenceFlow>
  process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_tes_flow">
    <bpmndi:BPMNPlane bpmnElement="tes_flow" id="BPMNPlane_tes_flow">
      <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-0C834D81-78B6-4A0F-B9FD-60B2063A1D72" id="BPMNShape_sid-0C834D81-78B6-4A0F-B9FD-60B2063A1D72">
        <omgdc:Bounds height="80.0" width="100.0" x="195.0" y="125.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-389474D7-E2B6-4E26-B2C0-28B8EFFF9DA8" id="BPMNShape_sid-389474D7-E2B6-4E26-B2C0-28B8EFFF9DA8">
        <omgdc:Bounds height="28.0" width="28.0" x="375.0" y="151.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-B984EF00-0BAF-4629-8A93-28C9BE1A7390" id="BPMNEdge_sid-B984EF00-0BAF-4629-8A93-28C9BE1A7390">
        <omgdi:waypoint x="119.94999906759469" y="165.0">omgdi:waypoint>
        <omgdi:waypoint x="195.0" y="165.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-4E62474A-57C3-4B99-8BD6-ABEC2B0B126A" id="BPMNEdge_sid-4E62474A-57C3-4B99-8BD6-ABEC2B0B126A">
        <omgdi:waypoint x="294.95000000000005" y="165.0">omgdi:waypoint>
        <omgdi:waypoint x="375.0" y="165.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
    bpmndi:BPMNPlane>
  bpmndi:BPMNDiagram>
definitions>

定时开始事件

说明

设置定时条件,到达指定条件执行,比如月初盘点任务,部署后将在act_ru_timer_job生成一条记录DUEDATE_ 为下次执行时间 需要设置

springProcessEngineConfiguration.setAsyncExecutorActivate(true);

设计

如果有多个仓 每个仓都有月初盘点,这种需求就建议使用空开始实际,自己实现定时任务 达到多仓各启动一个流程

相关参数

timeDate

在指定时间点执行 使用 ISO 8601

如:2011-03-11T12:13:14

<timerEventDefinition>
    <timeDate>2011-03-11T12:13:14timeDate>
timerEventDefinition>

timeDuration

指定定时器之前要等待多长时间, timeDuration可以设置为timerEventDefinition的子元素。 使用ISO 8601规定的格式 (由BPMN 2.0规定)。示例(等待10天)。

<timerEventDefinition>
    <timeDuration>P10DtimeDuration>
timerEventDefinition>

timeCycle

指定重复执行的间隔, 可以用来定期启动流程实例,或为超时时间发送多个提醒。 timeCycle元素可以使用两种格式。第一种是 ISO 8601 标准的格式。示例(重复3次,每次间隔10小时)

<timerEventDefinition>
    <timeCycle>R3/PT10HtimeCycle>
timerEventDefinition>

cron格式

如每月月初启动一个任务

0 0 2 1 * ?

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">
  <process id="start_time_event" name="测试定时开始事件" isExecutable="true">
    <startEvent id="sid-F50CF616-6913-42D7-8AF9-FF83B757AE87" isInterrupting="false">
      <timerEventDefinition>
        <timeCycle>0 0 2 1 * ?timeCycle>
      timerEventDefinition>
    startEvent>
    <userTask id="sid-7233D0D0-13E9-4289-9121-EB197441E371" name="月初盘点" flowable:assignee="仓管">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler">false]]>modeler:initiator-can-complete>
      extensionElements>
    userTask>
    <sequenceFlow id="sid-A9007E07-A21A-4641-8E72-89DDEB8E35B5" sourceRef="sid-F50CF616-6913-42D7-8AF9-FF83B757AE87" targetRef="sid-7233D0D0-13E9-4289-9121-EB197441E371">sequenceFlow>
    <userTask id="sid-6A306022-D7A3-4F78-B314-4B2EE2E4A136" name="仓管审核" flowable:assignee="主管">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler">false]]>modeler:initiator-can-complete>
      extensionElements>
    userTask>
    <sequenceFlow id="sid-BAFEEF3F-E759-4AE4-B24F-060FEFD6E7FF" sourceRef="sid-7233D0D0-13E9-4289-9121-EB197441E371" targetRef="sid-6A306022-D7A3-4F78-B314-4B2EE2E4A136">sequenceFlow>
    <endEvent id="sid-557EC890-5D02-4874-B49F-5BFA7F45C7DB">endEvent>
    <sequenceFlow id="sid-2E842EBE-505D-4523-AFDD-2F3DACEBC6F4" sourceRef="sid-6A306022-D7A3-4F78-B314-4B2EE2E4A136" targetRef="sid-557EC890-5D02-4874-B49F-5BFA7F45C7DB">sequenceFlow>
  process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_start_time_event">
    <bpmndi:BPMNPlane bpmnElement="start_time_event" id="BPMNPlane_start_time_event">
      <bpmndi:BPMNShape bpmnElement="sid-F50CF616-6913-42D7-8AF9-FF83B757AE87" id="BPMNShape_sid-F50CF616-6913-42D7-8AF9-FF83B757AE87">
        <omgdc:Bounds height="31.0" width="31.0" x="135.0" y="156.5">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-7233D0D0-13E9-4289-9121-EB197441E371" id="BPMNShape_sid-7233D0D0-13E9-4289-9121-EB197441E371">
        <omgdc:Bounds height="80.0" width="100.0" x="210.0" y="132.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-6A306022-D7A3-4F78-B314-4B2EE2E4A136" id="BPMNShape_sid-6A306022-D7A3-4F78-B314-4B2EE2E4A136">
        <omgdc:Bounds height="80.0" width="100.0" x="360.0" y="132.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-557EC890-5D02-4874-B49F-5BFA7F45C7DB" id="BPMNShape_sid-557EC890-5D02-4874-B49F-5BFA7F45C7DB">
        <omgdc:Bounds height="28.0" width="28.0" x="525.0" y="158.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-A9007E07-A21A-4641-8E72-89DDEB8E35B5" id="BPMNEdge_sid-A9007E07-A21A-4641-8E72-89DDEB8E35B5">
        <omgdi:waypoint x="166.94983571912417" y="172.4266062605313">omgdi:waypoint>
        <omgdi:waypoint x="209.99999999999784" y="172.22912844036696">omgdi:waypoint>
      bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-BAFEEF3F-E759-4AE4-B24F-060FEFD6E7FF" id="BPMNEdge_sid-BAFEEF3F-E759-4AE4-B24F-060FEFD6E7FF">
        <omgdi:waypoint x="309.9499999999581" y="172.0">omgdi:waypoint>
        <omgdi:waypoint x="360.0" y="172.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-2E842EBE-505D-4523-AFDD-2F3DACEBC6F4" id="BPMNEdge_sid-2E842EBE-505D-4523-AFDD-2F3DACEBC6F4">
        <omgdi:waypoint x="459.949999999939" y="172.0">omgdi:waypoint>
        <omgdi:waypoint x="525.0" y="172.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
    bpmndi:BPMNPlane>
  bpmndi:BPMNDiagram>
definitions>

信号开始事件

说明

当接收到某种信号时触发,信号和消息事件类似,区别在于信号是群发的特性,消息是一对一的。

触发有2种方式:

1.通过api触发

2.通过中间信号 抛出信号的方式触发

相关表:select * from act_ru_event_subscr

设计

1.先定义一个信号,主要定义接受信号的作用于,全局或者只是当前processInstance

针对流程实例,只有当流程实例发布信号,才能够被订阅

2.开始信号事件节点选择引用定义的信号

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">
  <signal id="start" name="start" flowable:scope="global">signal>
  <process id="test_signal" name="测试信号事件" isExecutable="true">
    <startEvent id="sid-CDECC44E-4CBE-4B55-A1BE-478B6E832079" isInterrupting="true">
      <signalEventDefinition signalRef="start">signalEventDefinition>
    startEvent>
    <userTask id="sid-19A5E82E-71A2-493B-941A-B095A8B8FD99" name="第一审核人" flowable:assignee="小二毛">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler">false]]>modeler:initiator-can-complete>
      extensionElements>
    userTask>
    <sequenceFlow id="sid-10CE3EA7-5116-40C5-9683-562BA20994EB" sourceRef="sid-CDECC44E-4CBE-4B55-A1BE-478B6E832079" targetRef="sid-19A5E82E-71A2-493B-941A-B095A8B8FD99">sequenceFlow>
    <endEvent id="sid-E58EF2A5-9E54-44B9-AA02-EAD25285CEDF">endEvent>
    <sequenceFlow id="sid-8D9518AE-D604-4150-AE5F-66C7BAC68726" sourceRef="sid-19A5E82E-71A2-493B-941A-B095A8B8FD99" targetRef="sid-E58EF2A5-9E54-44B9-AA02-EAD25285CEDF">sequenceFlow>
  process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_test_signal">
    <bpmndi:BPMNPlane bpmnElement="test_signal" id="BPMNPlane_test_signal">
      <bpmndi:BPMNShape bpmnElement="sid-CDECC44E-4CBE-4B55-A1BE-478B6E832079" id="BPMNShape_sid-CDECC44E-4CBE-4B55-A1BE-478B6E832079">
        <omgdc:Bounds height="30.0" width="30.0" x="85.0" y="226.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-19A5E82E-71A2-493B-941A-B095A8B8FD99" id="BPMNShape_sid-19A5E82E-71A2-493B-941A-B095A8B8FD99">
        <omgdc:Bounds height="80.0" width="100.0" x="165.0" y="201.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-E58EF2A5-9E54-44B9-AA02-EAD25285CEDF" id="BPMNShape_sid-E58EF2A5-9E54-44B9-AA02-EAD25285CEDF">
        <omgdc:Bounds height="28.0" width="28.0" x="330.0" y="227.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-10CE3EA7-5116-40C5-9683-562BA20994EB" id="BPMNEdge_sid-10CE3EA7-5116-40C5-9683-562BA20994EB">
        <omgdi:waypoint x="114.94999861835541" y="241.0">omgdi:waypoint>
        <omgdi:waypoint x="165.0" y="241.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-8D9518AE-D604-4150-AE5F-66C7BAC68726" id="BPMNEdge_sid-8D9518AE-D604-4150-AE5F-66C7BAC68726">
        <omgdi:waypoint x="264.95000000000005" y="241.0">omgdi:waypoint>
        <omgdi:waypoint x="330.0" y="241.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
    bpmndi:BPMNPlane>
  bpmndi:BPMNDiagram>
definitions>

api发布信号启动

//把信号发送给全局所有订阅的处理器(广播语义)。
runtimeService.signalEventReceived(String signalName);
//只把信息发送给指定的执行。
runtimeService.signalEventReceived(String signalName, String executionId)

可以查询所有订阅了特定信号事件的执行

 List executions = runtimeService.createExecutionQuery()
      .signalEventSubscriptionName("start")
      .list();

通过中间捕获事件启动

1.设计一个新的流程并定义信号

 

 2.抛出信号事件 引用此信号。

3.正常发布办理流程就会自动抛出此信号,之前定义的流程也会启动

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">
  <signal id="start" name="start" flowable:scope="global">signal>
  <process id="throw_event" name="抛出边界事件" isExecutable="true">
    <startEvent id="startEvent1">startEvent>
    <userTask id="sid-ED0D1DEB-78DF-41A4-B302-C18C4224F154" name="组长审批" flowable:assignee="大二毛">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler">false]]>modeler:initiator-can-complete>
      extensionElements>
    userTask>
    <sequenceFlow id="sid-F4A945FE-C68E-4A31-BC13-13120E4A76FE" sourceRef="startEvent1" targetRef="sid-ED0D1DEB-78DF-41A4-B302-C18C4224F154">sequenceFlow>
    <intermediateThrowEvent id="sid-B7D82EA4-B3AF-485A-8A43-85A86182264C" name="抛出start事件">
      <signalEventDefinition signalRef="start">signalEventDefinition>
    intermediateThrowEvent>
    <sequenceFlow id="sid-50D93938-8FAB-4BC3-BD53-2F15FC50834C" sourceRef="sid-ED0D1DEB-78DF-41A4-B302-C18C4224F154" targetRef="sid-B7D82EA4-B3AF-485A-8A43-85A86182264C">sequenceFlow>
    <endEvent id="sid-8F5581A7-248A-4674-89F5-074FC639F6CA" name="流程结束">endEvent>
    <sequenceFlow id="sid-C379A2A1-D914-4494-BD1D-1F29ECF16DB7" sourceRef="sid-B7D82EA4-B3AF-485A-8A43-85A86182264C" targetRef="sid-8F5581A7-248A-4674-89F5-074FC639F6CA">sequenceFlow>
  process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_throw_event">
    <bpmndi:BPMNPlane bpmnElement="throw_event" id="BPMNPlane_throw_event">
      <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-ED0D1DEB-78DF-41A4-B302-C18C4224F154" id="BPMNShape_sid-ED0D1DEB-78DF-41A4-B302-C18C4224F154">
        <omgdc:Bounds height="80.0" width="100.0" x="165.0" y="135.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-B7D82EA4-B3AF-485A-8A43-85A86182264C" id="BPMNShape_sid-B7D82EA4-B3AF-485A-8A43-85A86182264C">
        <omgdc:Bounds height="30.0" width="30.0" x="360.0" y="160.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-8F5581A7-248A-4674-89F5-074FC639F6CA" id="BPMNShape_sid-8F5581A7-248A-4674-89F5-074FC639F6CA">
        <omgdc:Bounds height="28.0" width="28.0" x="450.0" y="161.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-F4A945FE-C68E-4A31-BC13-13120E4A76FE" id="BPMNEdge_sid-F4A945FE-C68E-4A31-BC13-13120E4A76FE">
        <omgdi:waypoint x="129.94340692927761" y="177.55019845363262">omgdi:waypoint>
        <omgdi:waypoint x="164.99999999999906" y="176.4985">omgdi:waypoint>
      bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-C379A2A1-D914-4494-BD1D-1F29ECF16DB7" id="BPMNEdge_sid-C379A2A1-D914-4494-BD1D-1F29ECF16DB7">
        <omgdi:waypoint x="389.94999769378654" y="175.0">omgdi:waypoint>
        <omgdi:waypoint x="450.0" y="175.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-50D93938-8FAB-4BC3-BD53-2F15FC50834C" id="BPMNEdge_sid-50D93938-8FAB-4BC3-BD53-2F15FC50834C">
        <omgdi:waypoint x="264.9499999999329" y="175.0">omgdi:waypoint>
        <omgdi:waypoint x="360.0" y="175.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
    bpmndi:BPMNPlane>
  bpmndi:BPMNDiagram>
definitions>

消息开始事件

说明

消息事件和信号使用是一样的,只是定义的是消息而不是信号,我的理解,消息事件是用来对接消息发起流程的。消息可以是各种方式存在,比如jms 和rabbitMQ 等。具体消息对接需要自己对接。

相关表:select * from act_ru_event_subscr

设计

1.绘制流程图

 2.定义消息

3.引用消息

通过api启动

通过中间捕获事件启动

参考信号捕获事件使用

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="eventStart" name="eventStart">message>
  <process id="messageEvent" name="测试消息事件" isExecutable="true">
    <startEvent id="sid-F92AD7A8-CFDF-494B-BC4D-FEBA4A5A3881" isInterrupting="true">
      <messageEventDefinition messageRef="eventStart">messageEventDefinition>
    startEvent>
    <userTask id="sid-C539F41A-DCD0-4346-BB48-A6561C818D8C" name="第一审核人">userTask>
    <sequenceFlow id="sid-20FAA022-DAD5-4DDF-A276-A518D46B7261" sourceRef="sid-F92AD7A8-CFDF-494B-BC4D-FEBA4A5A3881" targetRef="sid-C539F41A-DCD0-4346-BB48-A6561C818D8C">sequenceFlow>
    <endEvent id="sid-ECC0C971-5787-4C81-9F36-DAE5C8B3F3D8">endEvent>
    <sequenceFlow id="sid-A88A387C-732A-4FCA-AFCE-EC620C379889" sourceRef="sid-C539F41A-DCD0-4346-BB48-A6561C818D8C" targetRef="sid-ECC0C971-5787-4C81-9F36-DAE5C8B3F3D8">sequenceFlow>
  process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_messageEvent">
    <bpmndi:BPMNPlane bpmnElement="messageEvent" id="BPMNPlane_messageEvent">
      <bpmndi:BPMNShape bpmnElement="sid-F92AD7A8-CFDF-494B-BC4D-FEBA4A5A3881" id="BPMNShape_sid-F92AD7A8-CFDF-494B-BC4D-FEBA4A5A3881">
        <omgdc:Bounds height="30.0" width="30.5" x="135.0" y="165.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-C539F41A-DCD0-4346-BB48-A6561C818D8C" id="BPMNShape_sid-C539F41A-DCD0-4346-BB48-A6561C818D8C">
        <omgdc:Bounds height="80.0" width="100.0" x="225.0" y="140.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-ECC0C971-5787-4C81-9F36-DAE5C8B3F3D8" id="BPMNShape_sid-ECC0C971-5787-4C81-9F36-DAE5C8B3F3D8">
        <omgdc:Bounds height="28.0" width="28.0" x="370.0" y="166.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-A88A387C-732A-4FCA-AFCE-EC620C379889" id="BPMNEdge_sid-A88A387C-732A-4FCA-AFCE-EC620C379889">
        <omgdi:waypoint x="324.95000000000005" y="180.0">omgdi:waypoint>
        <omgdi:waypoint x="370.0" y="180.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-20FAA022-DAD5-4DDF-A276-A518D46B7261" id="BPMNEdge_sid-20FAA022-DAD5-4DDF-A276-A518D46B7261">
        <omgdi:waypoint x="165.94999869879913" y="180.0">omgdi:waypoint>
        <omgdi:waypoint x="225.0" y="180.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
    bpmndi:BPMNPlane>
  bpmndi:BPMNDiagram>
definitions>

错误开始事件

说明

错误开始事件只能定义在子流程使用,当主流程抛出错误,被拦截器拦住,便会触发子流程错误开始事件流程

比如:我们一共设计两个流程,一个是子流程事件,一个是主流程。当这个流程启动,便会启动主流程。主流程的Servertask便会抛出一个BpmnError的流程错误。这个流程错误会被Activiti引擎拦截到,然户触发子流程事件里面的错误启动事件。从而触发SubServertask这个Server任务。

设计