flowable-流程中心设计之中间事件
Posted 意犹未尽
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了flowable-流程中心设计之中间事件相关的知识,希望对你有一定的参考价值。
简介
中间捕获事件,是可以作为一个流程节点存在,可以是抛出型,也可以是捕获型的
抛出型:抛出事件等待其他捕获型捕获比如开始事件、中间捕获事件、边界事件
捕获型:则是接收抛出型抛出的事件
中间定时事件
说明
中间定时事件是一个捕获事件,当执行到达捕获事件节点, 就会启动一个定时器。 当定时器触发(一段时间之后),流程就会沿着定时中间事件的外出节点继续执行。
可观察select * from act_ru_timer_job 此表
设计
用户下单节点完成后,会到达中间定时事件节点,同时select * from act_ru_timer_job 在这个表生成一条job记录 到达指定事件则完成此节点
相关参数设置
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="中间捕获事件测试" name="time_evet_test3" isExecutable="true"> <startEvent id="startEvent1"></startEvent> <userTask id="sid-93595C49-26DA-44F2-9BDE-AFCA9023FEC7" 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-AF8BE282-7418-4245-8A59-D4A8AACCFB12" sourceRef="startEvent1" targetRef="sid-93595C49-26DA-44F2-9BDE-AFCA9023FEC7"></sequenceFlow> <intermediateCatchEvent id="sid-05568350-8BAC-4EEF-840D-D39156EDD500"> <timerEventDefinition> <timeDuration>P5M</timeDuration> </timerEventDefinition> </intermediateCatchEvent> <sequenceFlow id="sid-AAEBC31E-FC1D-450F-B61B-9392C20DB6A0" sourceRef="sid-93595C49-26DA-44F2-9BDE-AFCA9023FEC7" targetRef="sid-05568350-8BAC-4EEF-840D-D39156EDD500"></sequenceFlow> <userTask id="sid-C91EBC29-619B-4F16-AC79-690ED1C4AE3E" name="生成发货单" flowable:assignee="大力强2"> <extensionElements> <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete> </extensionElements> </userTask> <endEvent id="sid-7A2E09EE-59BF-49DA-9205-84E719AAA2D1"></endEvent> <sequenceFlow id="sid-A6A4D364-551C-4B12-B577-34A442980D26" sourceRef="sid-C91EBC29-619B-4F16-AC79-690ED1C4AE3E" targetRef="sid-7A2E09EE-59BF-49DA-9205-84E719AAA2D1"></sequenceFlow> <sequenceFlow id="sid-6EB75DA4-8C43-487F-8708-7634BA340DA7" name="延迟5分钟" sourceRef="sid-05568350-8BAC-4EEF-840D-D39156EDD500" targetRef="sid-C91EBC29-619B-4F16-AC79-690ED1C4AE3E"></sequenceFlow> </process> <bpmndi:BPMNDiagram id="BPMNDiagram_中间捕获事件测试"> <bpmndi:BPMNPlane bpmnElement="中间捕获事件测试" id="BPMNPlane_中间捕获事件测试"> <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-93595C49-26DA-44F2-9BDE-AFCA9023FEC7" id="BPMNShape_sid-93595C49-26DA-44F2-9BDE-AFCA9023FEC7"> <omgdc:Bounds height="80.0" width="100.0" x="165.0" y="125.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="sid-05568350-8BAC-4EEF-840D-D39156EDD500" id="BPMNShape_sid-05568350-8BAC-4EEF-840D-D39156EDD500"> <omgdc:Bounds height="31.0" width="31.0" x="330.0" y="149.5"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="sid-C91EBC29-619B-4F16-AC79-690ED1C4AE3E" id="BPMNShape_sid-C91EBC29-619B-4F16-AC79-690ED1C4AE3E"> <omgdc:Bounds height="80.0" width="100.0" x="450.0" y="125.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="sid-7A2E09EE-59BF-49DA-9205-84E719AAA2D1" id="BPMNShape_sid-7A2E09EE-59BF-49DA-9205-84E719AAA2D1"> <omgdc:Bounds height="28.0" width="28.0" x="630.0" y="151.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNEdge bpmnElement="sid-AAEBC31E-FC1D-450F-B61B-9392C20DB6A0" id="BPMNEdge_sid-AAEBC31E-FC1D-450F-B61B-9392C20DB6A0"> <omgdi:waypoint x="264.94999999999357" y="165.1906488549618"></omgdi:waypoint> <omgdi:waypoint x="330.0000092162973" y="165.43893173323616"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="sid-AF8BE282-7418-4245-8A59-D4A8AACCFB12" id="BPMNEdge_sid-AF8BE282-7418-4245-8A59-D4A8AACCFB12"> <omgdi:waypoint x="119.94999848995758" y="165.0"></omgdi:waypoint> <omgdi:waypoint x="165.0" y="165.0"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="sid-A6A4D364-551C-4B12-B577-34A442980D26" id="BPMNEdge_sid-A6A4D364-551C-4B12-B577-34A442980D26"> <omgdi:waypoint x="549.9499999999827" y="165.0"></omgdi:waypoint> <omgdi:waypoint x="630.0" y="165.0"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="sid-6EB75DA4-8C43-487F-8708-7634BA340DA7" id="BPMNEdge_sid-6EB75DA4-8C43-487F-8708-7634BA340DA7"> <omgdi:waypoint x="361.9499176799087" y="165.44805221616247"></omgdi:waypoint> <omgdi:waypoint x="449.99999999999545" y="165.16217532467533"></omgdi:waypoint> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </definitions>
以上是关于flowable-流程中心设计之中间事件的主要内容,如果未能解决你的问题,请参考以下文章