Flowable 6.6.0 用户指南相关文档下载
- BPMN用户指南 第一部分 - 中文PDF精编版
- BPMN用户指南 第二部分 - 中文PDF精编版
- BPMN用户指南 第三部分 - 中文PDF精编版
- 应用程序指南 - 中文PDF精编版
- 应用程序指南 - 中英对照PDF精编版
- 应用程序指南 - Eclipse设计器中文PDF精编版
- 表单用户指南 - 中文PDF精编版
- 事件注册表用户指南 - 中文PDF精编版
Flowable 6.6.0 事件注册表用户指南
目录
1 事件注册表介绍
- 1.1 什么是事件注册表
- 1.2 什么是事件定义
- 1.3 什么是通道定义(Channel definition)
2 配置
- 2.1 创建事件注册表引擎
- 2.2 EventRegistryEngineConfiguration bean
- 2.3 插入流程引擎
- 2.4 数据库配置
- 2.5 JNDI 数据源配置
- 2.6 支持的数据库
- 2.7 创建数据库表
- 2.8 数据库表名解释
- 2.9 数据库升级
- 2.10 部署缓存配置
- 2.11 Logging
3 Flowable 事件注册表API
- 3.1 事件注册表引擎API与服务
- 3.2 异常策略
- 3.3 查询API
- 3.4 单元测试
- 3.5 Web应用中的事件注册表引擎
4 Spring集成
5 部署
6 REST API
有关Flowable的更多文档,参见:
Flowable 6.6.0 事件注册表用户指南PDF版下载
2.5 JNDI 数据源配置
By default, the database configuration for Flowable Event Registry is contained within the db.properties files in the WEB-INF/classes of each web application. This isn’t always ideal because it requires users to either modify the db.properties in the Flowable source and recompile the WAR file, or explode the WAR and modify the db.properties on every deployment.
默认情况下,Flowable事件注册表的数据库配置包含在每个WEB应用程序的WEB-INF/ classes中的db.properties文件中。这并不总是理想的,因为它需要用户在Flowable源代码中修改db.properties,并重新编译WAR文件,或者解压缩WAR并修改在每次部署中的db.properties。
By using JNDI (Java Naming and Directory Interface) to obtain the database connection, the connection is fully managed by the Servlet Container and the configuration can be managed outside the war deployment. This also allows more control over the connection parameters than what is provided by the db.properties file.
通过使用JNDI(Java命名和目录接口,Java Naming and Directory Interface)获得数据库连接,连接完全由Servlet容器(Servlet Container)管理,配置可以在war部署之外进行管理。这还允许对连接参数进行更好(对比db.properties文件)的控制。
2.5.1 配置
Configuration of the JNDI datasource will differ depending on what servlet container application you are using. The instructions below will work for Tomcat, but for other container applications, please refer to the documentation for your container app.
JNDI数据源的配置将根据您使用的servlet容器应用程序而有所不同。以下说明适用于Tomcat,但对于其他容器应用程序,请参阅容器应用程序的文档。
If using Tomcat, the JNDI resource is configured within $CATALINA_BASE/conf/[enginename]/[hostname]/[warname].xml (for the Flowable UI this will usually be $CATALINA_BASE/conf/Catalina/localhost/flowable-app.xml). The default context is copied from the Flowable WAR file when the application is first deployed, so if it already exists, you will need to replace it. To change the JNDI resource so that the application connects to MySQL instead of H2, for example, change the file to the following:
如果使用Tomcat,JNDI资源将在 C A T A L I N A B A S E / c o n f / [ e n g i n e n a m e ] / [ h o s t n a m e ] / [ w a r n a m e ] . x m l 中 配 置 ( 对 于 F l o w a b l e U I , 通 常 是 CATALINA_BASE/conf/[enginename]/[hostname]/[warname].xml中配置(对于Flowable UI,通常是 CATALINABASE/conf/[enginename]/[hostname]/[warname].xml中配置(对于FlowableUI,通常是CATALINA_BASE/conf/Catalina/localhost/flowable-app.xml). 默认上下文是在应用程序首次部署时从Flowable WAR文件复制的,因此如果它已经存在,则需要替换它。例如,要更改JNDI资源以便应用程序连接到MySQL而不是H2,请将文件更改为:
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/flowable-app">
<Resource auth="Container"
name="jdbc/flowableDB"
type="javax.sql.DataSource"
description="JDBC DataSource"
url="jdbc:mysql://localhost:3306/flowable"
driverClassName="com.mysql.jdbc.Driver"
username="sa"
password=""
defaultAutoCommit="false"
initialSize="5"
maxWait="5000"
maxActive="120"
maxIdle="5"/>
</Context>
2.5.2 JNDI 属性
To configure a JNDI Datasource, use the following properties in the properties file for the Flowable UI:
要配置JNDI数据源,请在Flowable UI的属性文件中使用以下属性:
- spring.datasource.jndi-name=: the JNDI name of the Datasource.
- datasource.jndi.resourceRef: Set whether the lookup occurs in a J2EE container, in other words, if the prefix “java:comp/env/” needs to be added if the JNDI name doesn’t already contain it. Default is “true”.
- spring.datasource.jndi文件-name=:数据源的JNDI名称。
- datasource.jndi.resourceRef:设置是否在J2EE容器中进行查找,换句话说,如果JNDI名称尚未包含前缀java:comp/env/,是否需要添加该前缀。默认值为“true”。
2.5.3 自定义属性
System properties can also be used in the flowable.eventregistry.cfg.xml by using them in the format ${propertyName:defaultValue}.
系统属性也可以用于flowable.eventregistry.cfg.xml,以 ${propertyName:defaultValue}格式使用它们。
<property name="jdbcUrl" value="${jdbc.url:jdbc:h2:mem:flowable;DB_CLOSE_DELAY=1000}" />
<property name="jdbcDriver" value="${jdbc.driver:org.h2.Driver}" />
<property name="jdbcUsername" value="${jdbc.username:sa}" />
<property name="jdbcPassword" value="${jdbc.password:}" />
Using this configuration if the property jdbc.url is available then it would be used for the jdbcUrl of the EventRegistryEngineConfiguration. Otherwise the value after the first : would be used.
It is also possible to define locations from where properties can be picked up from the system by using a bean of type org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.
Example configuration with custom location for properties
如果属性jdbc.url可以,则使用该配置,然后则它将用于EventRegistryEngineConfiguration的jdbcUrl。否则将使用第一个“: ”后面的值。
还可以通过使用类型为org.springframework.beans.factory.config.PropertyPlaceholderConfigurer的bean来定义可以从系统中获取属性的位置。
属性的自定义位置配置示例
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="file:/opt/conf/flowable.properties" />
</bean>
<bean id="eventRegistryEngineConfiguration" class="org.flowable.eventregistry.impl.cfg.StandaloneEventRegistryEngineConfiguration">
<property name="jdbcUrl" value="${jdbc.url:jdbc:h2:mem:flowable;DB_CLOSE_DELAY=1000}" />
<property name="jdbcDriver" value="${jdbc.driver:org.h2.Driver}" />
<property name="jdbcUsername" value="${jdbc.username:sa}" />
<property name="jdbcPassword" value="${jdbc.password:}" />
<property name="databaseSchemaUpdate" value="true" />
</bean>
</beans>
With this configuration the properties would be first looked up in the /opt/conf/flowable.properties file.
使用此配置,将首先在/opt/conf/flowable.properties中查找属性文件。