Flowable 6.6.0 事件注册表用户指南 - 2 配置 - 2.4 数据库配置

Flowable 6.6.0 用户指南相关文档下载


Flowable6.6.0用户文档精编PDF版下载


Flowable 6.6.0 事件注册表用户指南

目录

1 事件注册表介绍

2 配置

3 Flowable 事件注册表API

4 Spring集成
5 部署

6 REST API


有关Flowable的更多文档,参见:

《Flowable文档大全》


Flowable 6.6.0 事件注册表用户指南PDF版下载

请点击:《事件注册表用户指南 - 中文PDF精编版》


2.4 数据库配置

There are two ways to configure the database that the Flowable Event Registry engine will use. The first option is to define the JDBC properties of the database:

有两种方法可以配置Flowable事件注册表引擎(Flowable Event Registry engine)将使用的数据库。第一个选项是定义数据库的JDBC属性:

  • jdbcUrl: JDBC URL of the database.

  • jdbcDriver: implementation of the driver for the specific database type.

  • jdbcUsername: username to connect to the database.

  • jdbcPassword: password to connect to the database.

  • jdbcUrl:数据库的JDBC URL。

  • jdbcDriver:实现特定数据库类型的驱动程序。

  • jdbcUsername:连接到数据库的用户名。

  • jdbcPassword:连接到数据库的密码。

The data source that is constructed based on the provided JDBC properties will have the default MyBatis connection pool settings. The following attributes can optionally be set to tweak that connection pool (taken from the MyBatis documentation):

基于提供的JDBC属性构造的数据源将具有默认的MyBatis连接池设置。可以选择设置以下属性来调整该连接池(取自MyBatis文档):

  • jdbcMaxActiveConnections: The maximum number of active connections that the connection pool can contain at any time. Default is 10.
  • jdbcMaxIdleConnections: The maximum number of idle connections that the connection pool can contain at any time.
  • jdbcMaxCheckoutTime: The amount of time in milliseconds a connection can be ‘checked out’ from the connection pool before it is forcefully returned. Default is 20000 (20 seconds).
  • jdbcMaxWaitTime: This is a low level setting that gives the pool a chance to print a log status and re-attempt the acquisition of a connection in the case that it is taking unusually long (to avoid failing silently forever if the pool is misconfigured) Default is 20000 (20 seconds).
  • jdbcMaxActiveConnections:连接池随时可以包含的最大活动连接数。默认值为10。
  • jdbcMaxIdleConnections:连接池随时可以包含的最大空闲连接数。
  • jdbcMaxCheckoutTime:可以强制从连接池中签出连接的时间(以毫秒计)。默认值为20000(20秒)。
  • jdbcMaxWaitTime:这是一个较低级别的设置,它使池有机会打印日志状态,并在异常长的时间内重新尝试获取连接(以避免在池配置错误时永远无提示地失败)默认值为20000(20秒)。

Example database configuration:

数据库配置示例:


<property name="jdbcUrl" value="jdbc:h2:mem:flowable_event;DB_CLOSE_DELAY=1000" />
<property name="jdbcDriver" value="org.h2.Driver" />
<property name="jdbcUsername" value="sa" />
<property name="jdbcPassword" value="" />

Our benchmarks have shown that the MyBatis connection pool is not the most efficient or resilient when dealing with a lot of concurrent requests. As such, it is advisable to us a javax.sql.DataSource implementation (such as HikariCP, Tomcat JDBC Connection Pool, and so on) and inject it into the event registry engine configuration :

我们的基准测试表明,在处理大量并发请求时,MyBatis连接池并不是最有效或最具弹性的。因此,建议我们javax.sql.DataSource实现(如HikariCP、Tomcat JDBC连接池等)并将其注入到事件注册表引擎配置中:

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" >
  <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  <property name="url" value="jdbc:mysql://localhost:3306/flowable_event" />
  <property name="username" value="flowable" />
  <property name="password" value="flowable" />
  <property name="defaultAutoCommit" value="false" />
</bean>

<bean id="eventRegistryEngineConfiguration" class="org.flowable.eventregistry.impl.cfg.StandaloneEventRegistryEngineConfiguration">

    <property name="dataSource" ref="dataSource" />
    ...

Note that Flowable Event Registry does not ship with a library that allows you to define such a data source. So you have to make sure that the libraries are on your classpath.

The following properties can be set, regardless of whether you are using the JDBC or data source approach:

请注意,Flowable Event Registry不附带允许您定义此类数据源的库。所以你必须确保这些库在你的classpath上。

无论您使用的是JDBC还是数据源方法,都可以设置以下属性:

  • databaseType: it’s normally not necessary to specify this property as it is automatically detected from the database connection metadata. Should only be specified in case automatic detection fails. Possible values: {h2, mysql, oracle, postgres, mssql, db2}. This setting will determine which create/drop scripts and queries will be used. See the ‘supported databases’ section for an overview of which types are supported.
  • databaseType:通常不需要指定此属性,因为它是从数据库连接元数据中自动检测到的。仅在自动检测失败时指定。可能的值:{h2,mysql,oracle,postgres,mssql,db2}。此设置将确定将使用哪些创建/删除脚本和查询。有关支持哪些类型的概述,请参阅“支持的数据库”部分。
  • databaseSchemaUpdate: allows you to set the strategy to handle the database schema on process engine boot and shutdown.
  • databaseSchemaUpdate:允许您设置在进程引擎启动和关闭时处理数据库schema的策略。
    • false (default): Checks the version of the DB schema against the library when the event registry engine is being created and throws an exception if the versions don’t match.
    • true: Upon building the event registry engine, a check is performed and an update of the schema is performed if it is necessary. If the schema doesn’t exist, it is created.
    • create-drop: Creates the schema when the event registry engine is being created and drops the schema when the event registry engine is being closed.
    • false(默认):在创建事件注册表引擎时,根据库检查DB schema的版本,如果版本不匹配,则抛出异常。
    • true:在构建事件注册表引擎时,将执行检查,并在必要时执行schema更新。如果schema不存在,则创建它。
    • create-drop:在创建事件注册表引擎时创建schema,在关闭事件注册表引擎时删除schema。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

月满闲庭

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值