Activiti6测试数据观察——并行网关

 

流程图:1-4-2-3-5-6-7


流程文档:

1.部署流程:

略,可参考请假流程

 

2.启动流程

select * from act_ru_execution;

 

select * from act_ru_task;

select * from act_ru_variable;

select * from act_ru_identitylink;

select * from act_hi_procinst;

select * from act_hi_actinst;

select * from act_hi_taskinst;

select * from act_hi_varinst;

select * from act_hi_identitylink;

3.办理流程

select * from act_ru_execution;

select * from act_ru_task;

select * from act_ru_variable;

select * from act_ru_identitylink;

select * from act_hi_procinst;

select * from act_hi_actinst;

select * from act_hi_taskinst;

select * from act_hi_varinst;

select * from act_hi_identitylink;

 

4.办理流程

 

select * from act_ru_execution;

此时parallelgateway2的IS_ACTIVE_字段为0

select * from act_ru_task;

select * from act_ru_variable;

select * from act_ru_identitylink;

select * from act_hi_procinst;

select * from act_hi_actinst;

此时parallelgateway2的END_TIME_字段已经有值了,是否合理?

select * from act_hi_taskinst;

select * from act_hi_varinst;

select * from act_hi_identitylink;

 

5.办理流程

select * from act_ru_execution;

select * from act_ru_task;

 

select * from act_ru_variable;

同上

select * from act_ru_identitylink;

select * from act_hi_procinst;

select * from act_hi_actinst;

select * from act_hi_taskinst;

select * from act_hi_varinst;

select * from act_hi_identitylink;

 

6.办理流程

select * from act_ru_execution;

select * from act_ru_task;

select * from act_ru_variable;

同上

select * from act_ru_identitylink;

select * from act_hi_procinst;

select * from act_hi_actinst;

select * from act_hi_taskinst;

select * from act_hi_varinst;

同上

select * from act_hi_identitylink;

 

7.办理流程

select * from act_ru_execution;

select * from act_ru_task;

select * from act_ru_variable;

同上

select * from act_ru_identitylink;

同上

select * from act_hi_procinst;

select * from act_hi_actinst;

select * from act_hi_taskinst;

select * from act_hi_varinst;

同上

select * from act_hi_identitylink;

同上

 

8.办理流程

select * from act_ru_execution;

select * from act_ru_task;

select * from act_ru_variable;

同上

select * from act_ru_identitylink;

select * from act_hi_procinst;

select * from act_hi_actinst;

select * from act_hi_taskinst;

select * from act_hi_varinst;

select * from act_hi_identitylink;

 

9.办理流程

select * from act_ru_execution;

select * from act_ru_task;

select * from act_ru_variable;

select * from act_ru_identitylink;

 

select * from act_hi_procinst;

select * from act_hi_actinst order by END_TIME_ ASC;

select * from act_hi_taskinst order by END_TIME_ ASC;

select * from act_hi_varinst;

select * from act_hi_identitylink;

总结:

并行网关的特性:

并行网关后的连线全部有效,不进行条件表达式判断。

 

问题1:并行网关是怎么实现聚合效果的?

推测:根据并行网关的入线数量进行判断,比如parallelgateway2有两个入线,那么当有两个不同的execution执行到网关时,流程就会继续流转。

源码验证:

### Activiti 6 的核心功能与使用方法 Activiti 是一款开源的工作流和业务流程管理 (BPM) 平台,广泛应用于企业级应用开发中。以下是关于 Activiti 6 的一些关键特性和使用方法: #### 数据库模式更新策略 `databaseSchemaUpdate` 配置项用于定义 Activiti 流程引擎在启动和关闭时如何处理数据库结构的变化。它支持四种主要的值: - `false`: 默认值。当 Activiti 启动时,如果检测到数据库中的表缺失或版本不一致,则会抛出异常[^1]。 - `true`: 如果数据库中的某些表不存在,Activiti 将自动生成这些表;对于已存在的表,Activiti 会尝试对其进行升级以适配当前版本的需求。 - `create-drop`: 在 Activiti 启动时创建所需的数据库表,并在应用程序关闭时删除它们。这种模式通常适用于测试环境。 - `drop-create`: 在 Activiti 启动前先删除现有的数据库表,再重新创建新的表。此选项同样适合于测试场景,但在生产环境中应谨慎使用。 #### 主要任务类型 Activiti 提供了多种任务类型来满足不同的业务需求,其中包括但不限于以下几种: - **用户任务**: 表示需要人工干预的任务,例如审批请求等。 - **服务任务**: 自动化执行特定逻辑的服务调用任务。 - **脚本任务**: 执行嵌入式脚本的语言(如 JavaScript 或 Groovy)。 - **业务规则任务**: 基于 Drools 或其他规则引擎实现动态决策。 - **接收任务**: 等待外部触发的消息或其他事件。 - **邮件任务**: 发送电子邮件通知给指定收件人。 以上每种任务都可以通过 BPMN 图形界面设计工具进行配置,并映射至实际的应用程序代码中[^2]。 #### 构造组件 除了基本的任务之外,还可以利用子流程、事件子流程等功能模块构建更加复杂的业务流程模型。例如,“子流程”允许将大而复杂的过程分解成若干个小部分以便管理和维护;“事件子流程”则专注于响应各种类型的运行时事件。 #### 支持的分支控制机制 为了适应多样化的业务逻辑流转路径,Activiti 还提供了丰富的分支条件设定方式,比如排他网关(Exclusive Gateway),并行网关(Parallel Gateway),以及包容性网关(Inclusive Gateway)。开发者可以根据实际情况灵活选用合适的方案完成对不同情况下的判断与分流操作。 #### 属性元素扩展能力 针对具体应用场景可能提出的特殊定制要求,Activiti 设计了一系列可选参数用来增强其灵活性。像异步执行标记(`async`)可以让耗时较长的操作脱离主线程单独运行从而提高整体性能表现;多实例特性(multi-instance feature)能够轻松应对批量数据处理类作业等等。 #### 监听器配置指南 最后值得一提的是监听器机制——这是监控整个生命周期活动状态变化的重要手段之一。包括但不限于以下几个方面: - **执行监听器**(Execution Listener): 负责捕获节点进入/退出时刻发生的动作; - **任务监听器**(Task Listener): 关注任务被创建、指派、完成等一系列重要环节的信息记录工作; - **全局事件监听器**(Global Event Listener): 实现跨多个独立部署单元之间的通信协作目的。 --- ```java // 示例:初始化 Activiti 流程引擎工厂 ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); RepositoryService repositoryService = processEngine.getRepositoryService(); // 部署一个新的流程定义文件 repositoryService.createDeployment() .addClasspathResource("processes/my-process.bpmn20.xml") .deploy(); ``` 上述代码片段展示了如何基于 Java API 来加载一个预定义好的 BPMN 文件资源,并将其注册到系统当中去准备后续的实际运用阶段。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值