在使用开源Camunda流程引擎做二次开发时,网关是必须要接触的。在Camunda的 Modeler工具中提供了4种类型的网关:Exclusive Gateway(独占网关)、Parallel Gateway(并行网关)、Inclusive Gateway(包容性网关)、Event-based Gateway(基于事件的网关),每一个网关都有自己独特的功能,这一篇就先介绍  Parallel Gateway(并行网关)。

Inclusive Gateway(包容性网关)

The Inclusive Gateway can be seen as a combination of an exclusive and a parallel gateway. Like an exclusive gateway, you can define conditions on outgoing sequence flows and the inclusive gateway will evaluate them. However, the main difference is that the inclusive gateway can receive more than one sequence flow, like a parallel gateway.

大概意思为:包容性网关可以被视为独家网关和并行网关的组合。与独家网关一样,您可以定义传出序列流的条件,包容性网关将对其进行评估。然而,主要区别在于,包容性网关可以接收多个序列流,如并行网关。

The functionality of the inclusive gateway is based on the incoming and outgoing sequence flows:

* fork: all outgoing sequence flow conditions are evaluated and for the sequence flow conditions that evaluate to ‘true’, the flows are followed in parallel, creating one concurrent execution for each sequence flow.

* join: all concurrent executions arriving at the inclusive gateway wait at the gateway until an execution has arrived for each of the incoming sequence flows that have a process token. This is an important difference to the parallel gateway. So in other words, the inclusive gateway will only wait for the incoming sequence flows that are executed. After the join, the process continues past the joining inclusive gateway.

Note that an inclusive gateway can have both fork and join behavior, if there are multiple incoming and outgoing sequence flows for the same inclusive gateway. In that case, the gateway will first join all incoming sequence flows that have a process token, before splitting into multiple concurrent paths of executions for the outgoing sequence flows that have a condition that evaluates to ‘true’.

大概意思为:

包容性网关的功能基于传入和传出序列流:

  • 叉子:评估所有传出序列流条件,对于评估为“真实”的序列流条件,并行跟踪流,为每个序列流创建一个并发执行。

  • 连接:到达包容性网关的所有并发执行都在网关等待,直到每个具有进程令牌的传入序列流的执行到达。这是并行网关的一个重要区别。因此,换句话说,包容性网关只会等待执行的传入序列流。加入后,这个过程会继续通过加入包容性网关。

请注意,如果同一包容性网关有多个传入和传出序列流,则包容性网关可以同时具有 叉子 和 连接 行为。在这种情况下,网关将首先连接所有具有进程令牌的传入序列流,然后为具有计算为“true”条件的传出序列流分裂为多个并发执行路径。

总结:在输入、输出包容性网关的时候,包容性网关能够代替独占网关和并行网关。

流程实例

场景:公司里有请假的流程,先是组长审批,请假天数小于等于3天的只需要人事审批,而对大于3天的需要经理审批,并且对于大于等于5天的需要老板审批。老板需要知道一年中哪些人一次性请假超过5天的,好扣年终奖。

请假流程图:

节占条件参数配置:

BPMN流程模型文件:

<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0pijek2" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.11.1" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0"><bpmn:process id="Process_0zkorla" name="包容性网关测试" isExecutable="true"><bpmn:startEvent id="Event_00hn1zz"><bpmn:outgoing>Flow_10ol650</bpmn:outgoing></bpmn:startEvent><bpmn:endEvent id="Event_0rlc15d"><bpmn:incoming>Flow_15r52g1</bpmn:incoming></bpmn:endEvent><bpmn:userTask id="Activity_1bhicu5" name="组长审批"><bpmn:incoming>Flow_10ol650</bpmn:incoming><bpmn:outgoing>Flow_1xvew9w</bpmn:outgoing></bpmn:userTask><bpmn:userTask id="Activity_1wsop74" name="人事审批"><bpmn:incoming>Flow_1dkejle</bpmn:incoming><bpmn:outgoing>Flow_1g3r6v4</bpmn:outgoing></bpmn:userTask><bpmn:userTask id="Activity_0fvflup" name="经理审批"><bpmn:incoming>Flow_0gamcen</bpmn:incoming><bpmn:outgoing>Flow_0jxg79k</bpmn:outgoing></bpmn:userTask><bpmn:sequenceFlow id="Flow_10ol650" sourceRef="Event_00hn1zz" targetRef="Activity_1bhicu5" /><bpmn:sequenceFlow id="Flow_1xvew9w" sourceRef="Activity_1bhicu5" targetRef="Gateway_1k9gcg8" /><bpmn:sequenceFlow id="Flow_0gamcen" name="大于3天" sourceRef="Gateway_1k9gcg8" targetRef="Activity_0fvflup"><bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${isDays&gt;3}</bpmn:conditionExpression></bpmn:sequenceFlow><bpmn:sequenceFlow id="Flow_1dkejle" name="小于等于3天" sourceRef="Gateway_1k9gcg8" targetRef="Activity_1wsop74"><bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${isDays&lt;=3}</bpmn:conditionExpression></bpmn:sequenceFlow><bpmn:sequenceFlow id="Flow_03yz94u" sourceRef="Gateway_0cdw7jc" targetRef="Activity_1azj6fl" /><bpmn:sequenceFlow id="Flow_1g3r6v4" sourceRef="Activity_1wsop74" targetRef="Gateway_0cdw7jc" /><bpmn:sequenceFlow id="Flow_0jxg79k" sourceRef="Activity_0fvflup" targetRef="Gateway_0cdw7jc" /><bpmn:sequenceFlow id="Flow_15r52g1" sourceRef="Activity_1azj6fl" targetRef="Event_0rlc15d" /><bpmn:userTask id="Activity_1azj6fl" name="保存"><bpmn:incoming>Flow_03yz94u</bpmn:incoming><bpmn:outgoing>Flow_15r52g1</bpmn:outgoing></bpmn:userTask><bpmn:userTask id="Activity_1m3l1qx" name="老板审批"><bpmn:incoming>Flow_09e96up</bpmn:incoming><bpmn:outgoing>Flow_1ez2y5a</bpmn:outgoing></bpmn:userTask><bpmn:sequenceFlow id="Flow_09e96up" name="大于等于5天" sourceRef="Gateway_1k9gcg8" targetRef="Activity_1m3l1qx"><bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${isDays&gt;=5}</bpmn:conditionExpression></bpmn:sequenceFlow><bpmn:sequenceFlow id="Flow_1ez2y5a" sourceRef="Activity_1m3l1qx" targetRef="Gateway_0cdw7jc" /><bpmn:inclusiveGateway id="Gateway_1k9gcg8"><bpmn:incoming>Flow_1xvew9w</bpmn:incoming><bpmn:outgoing>Flow_0gamcen</bpmn:outgoing><bpmn:outgoing>Flow_1dkejle</bpmn:outgoing><bpmn:outgoing>Flow_09e96up</bpmn:outgoing></bpmn:inclusiveGateway><bpmn:inclusiveGateway id="Gateway_0cdw7jc"><bpmn:incoming>Flow_1g3r6v4</bpmn:incoming><bpmn:incoming>Flow_0jxg79k</bpmn:incoming><bpmn:incoming>Flow_1ez2y5a</bpmn:incoming><bpmn:outgoing>Flow_03yz94u</bpmn:outgoing></bpmn:inclusiveGateway></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_0zkorla"><bpmndi:BPMNEdge id="Flow_10ol650_di" bpmnElement="Flow_10ol650"><di:waypoint x="188" y="230" /><di:waypoint x="270" y="230" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id="Flow_1xvew9w_di" bpmnElement="Flow_1xvew9w"><di:waypoint x="370" y="230" /><di:waypoint x="445" y="230" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id="Flow_0gamcen_di" bpmnElement="Flow_0gamcen"><di:waypoint x="470" y="205" /><di:waypoint x="470" y="120" /><di:waypoint x="620" y="120" /><bpmndi:BPMNLabel><dc:Bounds x="530" y="103" width="40" height="14" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge><bpmndi:BPMNEdge id="Flow_1dkejle_di" bpmnElement="Flow_1dkejle"><di:waypoint x="495" y="230" /><di:waypoint x="620" y="230" /><bpmndi:BPMNLabel><dc:Bounds x="527" y="212" width="62" height="14" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge><bpmndi:BPMNEdge id="Flow_03yz94u_di" bpmnElement="Flow_03yz94u"><di:waypoint x="835" y="230" /><di:waypoint x="890" y="230" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id="Flow_1g3r6v4_di" bpmnElement="Flow_1g3r6v4"><di:waypoint x="720" y="230" /><di:waypoint x="785" y="230" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id="Flow_0jxg79k_di" bpmnElement="Flow_0jxg79k"><di:waypoint x="720" y="120" /><di:waypoint x="810" y="120" /><di:waypoint x="810" y="205" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id="Flow_15r52g1_di" bpmnElement="Flow_15r52g1"><di:waypoint x="990" y="230" /><di:waypoint x="1032" y="230" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id="Flow_09e96up_di" bpmnElement="Flow_09e96up"><di:waypoint x="470" y="255" /><di:waypoint x="470" y="340" /><di:waypoint x="620" y="340" /><bpmndi:BPMNLabel><dc:Bounds x="499" y="313" width="62" height="14" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge><bpmndi:BPMNEdge id="Flow_1ez2y5a_di" bpmnElement="Flow_1ez2y5a"><di:waypoint x="720" y="340" /><di:waypoint x="810" y="340" /><di:waypoint x="810" y="255" /></bpmndi:BPMNEdge><bpmndi:BPMNShape id="Event_00hn1zz_di" bpmnElement="Event_00hn1zz"><dc:Bounds x="152" y="212" width="36" height="36" /></bpmndi:BPMNShape><bpmndi:BPMNShape id="Event_0rlc15d_di" bpmnElement="Event_0rlc15d"><dc:Bounds x="1032" y="212" width="36" height="36" /></bpmndi:BPMNShape><bpmndi:BPMNShape id="Activity_0jdk70q_di" bpmnElement="Activity_1azj6fl"><dc:Bounds x="890" y="190" width="100" height="80" /></bpmndi:BPMNShape><bpmndi:BPMNShape id="Activity_1wsop74_di" bpmnElement="Activity_1wsop74"><dc:Bounds x="620" y="190" width="100" height="80" /></bpmndi:BPMNShape><bpmndi:BPMNShape id="Activity_1bhicu5_di" bpmnElement="Activity_1bhicu5"><dc:Bounds x="270" y="190" width="100" height="80" /></bpmndi:BPMNShape><bpmndi:BPMNShape id="Activity_08s10xr_di" bpmnElement="Activity_1m3l1qx"><dc:Bounds x="620" y="300" width="100" height="80" /></bpmndi:BPMNShape><bpmndi:BPMNShape id="Activity_0fvflup_di" bpmnElement="Activity_0fvflup"><dc:Bounds x="620" y="80" width="100" height="80" /></bpmndi:BPMNShape><bpmndi:BPMNShape id="Gateway_0ymo95d_di" bpmnElement="Gateway_1k9gcg8"><dc:Bounds x="445" y="205" width="50" height="50" /></bpmndi:BPMNShape><bpmndi:BPMNShape id="Gateway_0a0ldpu_di" bpmnElement="Gateway_0cdw7jc"><dc:Bounds x="785" y="205" width="50" height="50" /></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram>
</bpmn:definitions>

部署流程并测试验证

流程发起后,第一个节点是组长审批。

组长在完成审批的时候,现在想要达到【经理审批】、【老板审批】,就需要提交的请假天数大于等于5天,所以这里要设置参数请假的天数 isDays:5天

包容性网关就实现了我们想要的目的,既产生【经理审批】、【老板审批】

【经理审批】、【老板审批】都通过后,会流转到【保存】节点。到此包容性网关就完成分叉和汇聚的功能。

下一篇是 基于事件的网关(Event-based Gateway)介绍

使用Camunda流程引擎,关于包容性网关(Inclusive Gateway)使用相关推荐

  1. Camunda流程引擎及表结构认识

    一.认识  Camunda Camunda 是一种轻量级的商业流程开源平台. 同类型的产品有 osworkflow.jbpm.activiti.flowable.其中:Jbpm4.Activiti.F ...

  2. camunda流程引擎概念术语

    前言 本文重点介绍开源流程引擎camunda的核心概念,这些概念同样适用于JBMP.Activiti.Flowable流程引擎,了解这些基本概念和原理,使用流程引擎API将更得心应手. 一.Proce ...

  3. 中流-接入Camunda流程引擎

    中流-接入Camunda流程引擎 在线体验 配置maven依赖 <dependency><groupId>org.camunda.bpm.springboot</grou ...

  4. 包容网关 Inclusive Gateway

    包容网关 Inclusive Gateway 什么是包容网关? 包容网关(Inclusive Gateway)就是并行网关(Parallel Gateway)和排他网关(Exclusive Gatew ...

  5. camunda流程引擎如此简单(二)

    工作流服务组件和表介绍 camudna是从activity分裂出来的其实绝大多数表和activity也一致的,所以用户能很好地从activity迁移过来 几大服务介绍 服务名称 描述 Reposito ...

  6. 18、包含网关(Inclusive Gateway)

    描述 包含网关(inclusive gateway)结合了排他网关与并行网关的特点,即可以根据条件判断,也可以同时多个并行执行. 包含网关的使用也需要用到两部分. 叉子(fork): 用于并行任务开始 ...

  7. camunda流程引擎receive task节点用途

    Camunda的Receive Task用于在流程中等待外部系统或服务发送消息.当接收到消息后,Receive Task将流程继续执行.Receive Task通常用于与Send Task配合使用,以 ...

  8. camunda流程引擎如此简单「四」

    监听器的使用 EL表达式:${} Camunda BPM支持统一表达语言(EL),它是JSP 2.1标准(JSR-245)的一部分.因此,它使用开源的JUEL实现.要获得有关表达式语言用法的更多常规信 ...

  9. Camunda流程引擎 Modeler (二)

    Camunda Modeler是Camunda官方提供的建模器: Modeler - 独立安装的建模器([windows.linux.mac] 一.下载camunda-modeler Download ...

最新文章

  1. mysql 分库分表,真的能支持服务无限扩容么?
  2. BZOJ.3227.[SDOI2008]红黑树tree(树形DP 思路)
  3. 防止内存泄露 Linux下用Valgrind做检查【ZT】
  4. CSS实现标题右侧“更多”
  5. ActionMapping
  6. 华为eNSP BUG——关于OSPF Router ID选择问题
  7. save与persist差别
  8. 蓝牙音频传输格式:ACC,SBC,APTX和LDAC
  9. Java 链表元素如何从键盘输入 面试 笔试高频
  10. 计算机无法加载操作系统,由于关键系统驱动程序丢失或包含错误,因此无法加载操作系统。解决方案...
  11. 如何在项目工程建筑中使用二维码?
  12. antDesign 自定义分页样式
  13. c语言模拟交通信号,C语言编写的交通信号灯
  14. 亚马逊跨境电商开店注册流程之日本,澳洲,印度,中东,新加坡,巴西,土耳其
  15. 机器人课做的一个悬崖识别自动变向的一个小车
  16. 2021-09-15如何把一个字符串的大小写取反(大写变小写小写变大写),例如 ’AbC‘ 变成 ‘aBc‘
  17. php 读取并显示doc,PHP读取doc,docx,xls,pdf,txt内容
  18. 夏普电视android应用程序,教你解决夏普电视出现的“应用程序未安装”问题
  19. 深度学习细粒度图像研究汇总
  20. 运动模糊 motion blur

热门文章

  1. PEAR:PHP扩展与应用库
  2. panda读取excel文件内容时出错,提示excel表格不能被指定
  3. 万维网运行原理分析实验
  4. 游戏自动按键脚本4:飞车追捕
  5. html5烟花绽放效果
  6. java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z
  7. cat - EOF标志的使用
  8. Java学习笔记-Pair和Map
  9. 进程间通信、死锁、信号量、PV原语
  10. setTimeout执行时间