盘古BPM体验地址    盘古BPM交流群盘古BPM交流群号:963222735

flowable cfg.execution-related-entities-count

分享牛 2861℃

摘要:

Activiti6版本或者flowable版本中增加了与流程实例相关的一系列计数器。对应ACT_RU_EXECUTION表中IS_COUNT_ENABLED_、EVT_SUBSCR_COUNT_ , TASK_COUNT_ , JOB_COUNT_ , TIMER_JOB_COUNT_ , SUSP_JOB_COUNT_ ,DEADLETTER_JOB_COUNT_ ,VAR_COUNT_ , ID_LINK_COUNT_ 字段。

本文重点讲解该功能的开启以及使用


计数器功能开启


计时器功能默认是关闭的,因此要想使用该功能,很显然要开启,如何开启呢?我们来看一下配置文件如下所示:

<bean id="processEngineConfiguration"
class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<property name="history" value="audit" />
<property name="databaseSchemaUpdate" value="true" />
<property name="dataSource" ref="dataSource">
</property>
<property name="enableExecutionRelationshipCounts" value="true">
</property>
</bean>

上述代码中,只需要设置enableExecutionRelationshipCounts开关属性值为true即可。


部署流程文档


流程文档的部署代码如下:

@Test
public void addInputStreamTest() throws IOException {
// 定义的文件信息的流读取
InputStream inputStream = App.class.getClassLoader().getResource("com/shareniu/activiti6/ch1/MyProcess.bpmn")
.openStream();
// 流程定义的分类
String category = "shareniu_addInputStream";
// 构造DeploymentBuilder对象
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().category(category)
.addInputStream(resourceName, inputStream);
// 部署
Deployment deploy = deploymentBuilder.deploy();
System.out.println(deploy);
}
@Test
public void startProcessInstanceByMessage() {
runtimeService.startProcessInstanceById("myProcess:1:4");
}

完成任务

@Test
public void startProcessInstanceById() {
String taskId = "77505";
Map<String, Object> variables=new HashMap<>();
variables.put("a", "a");
variables.put("b", "a");
variables.put("c", "a");
taskService.complete(taskId,variables);
}

ACT_RU_EXECUTION表中的数据变化如下:


act_ge_property表


开启计数器功能之后,act_ge_property表的数据变化如下:

关于其他的字段含义,后面我们使用到了再说。


转载请注明:分享牛 » flowable cfg.execution-related-entities-count