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_flow</documentation>
    <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"><![CDATA[true]]></modeler:activiti-idm-assignee>
        <modeler:assignee-info-email xmlns:modeler="http://flowable.org/modeler"><![CDATA[13128273410]]></modeler:assignee-info-email>
        <modeler:assignee-info-firstname xmlns:modeler="http://flowable.org/modeler"><![CDATA[李強]]></modeler:assignee-info-firstname>
        <modeler:assignee-info-lastname xmlns:modeler="http://flowable.org/modeler"><![CDATA[李強]]></modeler:assignee-info-lastname>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[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:14</timeDate>
</timerEventDefinition>

 

timeDuration

指定定時器之前要等待多長時間, timeDuration可以設置爲timerEventDefinition的子元素。 使用ISO 8601規定的格式 (由BPMN 2.0規定)。示例(等待10天)。

<timerEventDefinition>
    <timeDuration>P10D</timeDuration>
</timerEventDefinition>

 

timeCycle

指定重複執行的間隔, 可以用來定期啓動流程實例,或爲超時時間發送多個提醒。 timeCycle元素可以使用兩種格式。第一種是 ISO 8601 標準的格式。示例(重複3次,每次間隔10小時)

<timerEventDefinition>
    <timeCycle>R3/PT10H</timeCycle>
</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"><![CDATA[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"><![CDATA[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>
View Code

信號開始事件

說明

當接收到某種信號時觸發,信號和消息事件類似,區別在於信號是羣發的特性,消息是一對一的。

觸發有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"><![CDATA[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>
View Code

 

api發佈信號啓動

//把信號發送給全局所有訂閱的處理器(廣播語義)。
runtimeService.signalEventReceived(String signalName);
//只把信息發送給指定的執行。
runtimeService.signalEventReceived(String signalName, String executionId)

可以查詢所有訂閱了特定信號事件的執行

 List<Execution> 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"><![CDATA[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>
View Code

消息開始事件

說明

消息事件和信號使用是一樣的,只是定義的是消息而不是信號,我的理解,消息事件是用來對接消息發起流程的。消息可以是各種方式存在,比如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>
View Code

 

錯誤開始事件

說明

錯誤開始事件只能定義在子流程使用,當主流程拋出錯誤,被攔截器攔住,便會觸發子流程錯誤開始事件流程

比如:我們一共設計兩個流程,一個是子流程事件,一個是主流程。當這個流程啓動,便會啓動主流程。主流程的Servertask便會拋出一個BpmnError的流程錯誤。這個流程錯誤會被Activiti引擎攔截到,然戶觸發子流程事件裏面的錯誤啓動事件。從而觸發SubServertask這個Server任務。

設計

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章