俯瞰工作流Activiti-引擎配置

本文详细介绍了开源工作流引擎Activiti的配置,包括流程引擎配置对象、数据库配置、任务执行器配置、邮件服务配置和历史数据配置。重点讨论了不同配置类的作用,如StandaloneProcessEngineConfiguration适用于独立环境,SpringProcessEngineConfiguration用于Spring整合。同时,讲解了数据库配置的JDBC和Mybatis连接池方式,以及历史数据保存的三个级别:none、audit和full。
摘要由CSDN通过智能技术生成

在开源工作流流程引擎Activiti的过程中,有很多参数是可配置的,例如数据库配置、事务配置、流程引擎内置服务配置等,Activiti通过流程引擎配置对象封装这些配置。本文对Activiti流程引擎的配置进行比较详细的介绍,让读者对各个配置项有深入的理解。
在这里插入图片描述

1.流程引擎配置对象

流程引擎配置对象ProcessEngineConfiguration里面有Activiti流程引擎里面的全部配置,为这些可配置的引擎属性提供对是对应的setter合getter方法。该类还提供了很多创建流程引擎配置对象ProcessEngineConfiguration实例的静态方法,这些方法会读取解析配置属性,然后返回对象的实例。该类是一个抽象类,实现类的类图结构如下图。在这里插入图片描述
ProcessEngineConfiguration代表流程引擎的一个配置实例,由于ProcessEngineConfiguration是一个抽象类,我们就要用它的子类去创建bean。官方文档给出了每个实现类的作用。

The activiti.cfg.xml must contain a bean that has the id processEngineConfiguration.

<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">

This bean is then used to construct the ProcessEngine. There are multiple classes available that can be used to define the processEngineConfiguration. These classes represent different environments, and set defaults ccordingly. It’s a best practice to select the class the matches (the most) your environment, to minimalise the number of properties needed to configure the engine. The following classes are currently available (more will follow in future releases):

  • org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration: the process engine is used in a standalone way. Activiti will take care of the transactions. By default, the database will only be checked when the engine boots (and an exception is thrown if there is no Activiti schema or the schema version is incorrect).
  • org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration: this is a convenience class for unit testing purposes. Activiti will take care of the transactions. An H2 in-memory database is used by default. The database will be created and dropped when the engine boots and shuts down. When using this, probably no additional configuration is needed (except when using for example the job executor or mail capabilities).
  • org.activiti.spring.SpringProcessEngineConfiguration: To be used when the process engine is used in a Spring environment.
  • org.activiti.engine.impl.cfg.JtaProcessEngineConfiguration: To be used when the engine runs in standalone mode, with JTA transactions.

简单翻译如下:
配置文件activiti.cfg.xml必须有一个id为

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值