flowable-流程中心设计之中间事件(六)
简介

中间定时事件
说明
设计
用户下单节点完成后,会到达中间定时事件节点,同时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>
中间捕获信号事件
说明
当到达此节点,会等待接收到信号才会完成下一个节点
api接收信号来源
//把信号发送给全局所有订阅的处理器(广播语义)。 runtimeService.signalEventReceived(String signalName); //只把信息发送给指定的执行。 runtimeService.signalEventReceived(String signalName, String executionId)
查询订阅了事件的执行流 对应表select * from act_ru_event_subscr
List<Execution> executions = runtimeService.createExecutionQuery() .signalEventSubscriptionName("start") .list();
通过抛出中间信号事件接收信号来源
查询订阅了事件的执行流 对应表select * from act_ru_event_subscr 也是观察这张表 里面有type区分
发起人填表后会开启并行网关,但是研发这条线会等待.等产品组长抛出审批信号后才会到研发负责人并行审批
信号源的作用范围
主要看我们定义信号设置接收范围
抛出中间信号事件
说明
信号中间Throwing事件用于抛出信号,当流程到达该事件时,会直接抛出信号,其他引用了相同信号的信号Catching事件会被触发。
设计
消息中间捕获事件
说明
消息中间捕获事件跟中间信号事件很相似,中间信号事件支持广播,消息事件只支持一对一
通过api接口消息源
查询订阅了此消息的执行流相关表:select * from act_ru_event_subscr
// 查询任务 Execution execution = runtimeService.createExecutionQuery() .messageEventSubscriptionName("msg") .processInstanceId(pi.getId()) .singleResult();
发布消息
设计
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· NetPad:一个.NET开源、跨平台的C#编辑器