第 32 章 配置 Quartz 计时器服务


当您在集群中运行 KIE Server 时,您可以配置 Quartz 计时器服务。

在应用服务器中配置数据库前,您必须准备 Quartz 的数据库,以创建 Quartz 表,该表将存放计时器数据和 Quartz 定义文件。

先决条件

  • 支持的非JTA 数据源连接到应用服务器,如 PostgreSQL 数据源。

流程

  1. 在数据库中创建 Quartz 表,使计时器事件能够使用您的数据库的 DDL 脚本同步。

    DDL 脚本位于 QUARTZ_HOME/docs/dbTables 中提取的 ZIP 存档中。

    注意

    包含单词 drop 的脚本,如 quartz_tables_drop_db2.sql 在创建前丢弃 Quartz 表。

  2. JBOSS_HOME/MODE/configuration/ 目录中创建 Quartz 配置文件 quartz-definition.properties,并添加以下示例内容:

    #=========================================================================
    # Configure Main Scheduler Properties
    #=========================================================================
    org.quartz.scheduler.instanceName = jBPMClusteredScheduler
    org.quartz.scheduler.instanceId = AUTO
    #=========================================================================
    # Configure ThreadPool
    #=========================================================================
    org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
    org.quartz.threadPool.threadCount = 5
    org.quartz.threadPool.threadPriority = 5
    #=========================================================================
    # Configure JobStore
    #=========================================================================
    org.quartz.jobStore.misfireThreshold = 60000
    org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreCMT
    org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
    org.quartz.jobStore.useProperties=false
    org.quartz.jobStore.dataSource=managedDS
    org.quartz.jobStore.nonManagedTXDataSource=notManagedDS
    org.quartz.jobStore.tablePrefix=QRTZ_
    org.quartz.jobStore.isClustered=true
    org.quartz.jobStore.clusterCheckinInterval = 20000
    #=========================================================================
    # Configure Datasources
    #=========================================================================
    org.quartz.dataSource.managedDS.jndiURL=jboss/datasources/psbpmsDS
    org.quartz.dataSource.notManagedDS.jndiURL=jboss/datasources/quartzNotManagedDS
    # Note the configured data sources that accommodate the two Quartz schemes at the very end of the file.
    重要

    集群发现的建议间隔为 20 秒,在 quartz-definition.properties 文件的 org.quartz.jobStore.clusterCheckinInterval 属性中设置。考虑对您的系统的性能影响,并根据需要修改设置。

  3. org.quartz.properties 属性中提供到 quartz-definition.properties 文件的绝对路径。
  4. 可选: 要为 Quartz 触发器配置重试和延迟次数,请更新以下系统属性:

    • org.jbpm.timer.quartz.retries (默认值为 5)
    • org.jbpm.timer.quartz.delay (默认值为 1000)
注意

默认情况下,Qrtz 需要两个数据源:

  • 参与进程引擎事务的受管数据源。
  • 非受管数据源用来查找触发的计时器,而无需任何事务处理

Red Hat Process Automation Manager 新应用程序假定 Quartz 数据库(schema)将与 Red Hat Process Automation Manager 表共存,因此生成用于 Quartz 的事务操作的数据源。

必须配置其他(非事务)数据源,但应指向与主数据源相同的数据库。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.