Chapter 32. Configuring Quartz timer service

When you run KIE Server in a cluster you can configure the Quartz timer service.

Before you configure a database on your application server, you must prepare the database for Quartz to create Quartz tables, which will hold the timer data, and the Quartz definition file.

Prerequisites

  • A supported non-JTA data source is connected to your application server, for example a PostgreSQL data source.

Procedure

  1. Create Quartz tables in your database to enable timer events to synchronize using the DDL script for your database.

    The DDL script is available in the extracted supplementary ZIP archive in QUARTZ_HOME/docs/dbTables.

    Note

    Scripts containing the word drop such as quartz_tables_drop_db2.sql drop the Quartz table before creating it.

  2. Create the Quartz configuration file quartz-definition.properties in the JBOSS_HOME/MODE/configuration/ directory and add the following example content:

    #=========================================================================
    # 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.
    Important

    The recommended interval for cluster discovery is 20 seconds and is set in the org.quartz.jobStore.clusterCheckinInterval attribute of the quartz-definition.properties file. Consider the performance impact on your system and modify the settings as necessary.

  3. Provide the absolute path to your quartz-definition.properties file in the org.quartz.properties property.
  4. Optional: To configure the number of retries and delay for the Quartz trigger, update the following system properties:

    • org.jbpm.timer.quartz.retries (default value is 5)
    • org.jbpm.timer.quartz.delay in milliseconds (default value is 1000)
Note

By default, Quartz requires two data sources:

  • Managed data source to participate in the transaction of the process engine.
  • Unmanaged data source to look up timers to trigger without any transaction handling

Red Hat Process Automation Manager business applications assume that the Quartz database (schema) will be co-located with Red Hat Process Automation Manager tables and therefore produce data sources used for transactional operations for Quartz.

The other (non transactional) data source must be configured but it should point to the same database as the main data source.