第31章 Quartz タイマーサービスの設定

クラスターで KIE Server を実行する場合には、Quartz タイマーサービスを設定する必要があります。

アプリケーションサーバーでデータベースを設定する前に、Quartz テーブルを作成するために Quarts データベースを準備する必要があります。このデータベースで、タイマーデータと Quartz 定義ファイルを保持します。

前提条件

  • サポートのある JTA 以外のデータソース (例: PostgreSQL データソースなど) がアプリケーションサーバーに接続されている。

手順

  1. データベースに Quartz テーブルを作成し、お使いのデータベース用の DDL スクリプトを使用してタイマーイベントが同期できるようにします。

    DDL スクリプトは、QUARTZ_HOME/docs/dbTables に展開した、補足用の Zip アーカイブにあります。

    注記

    quartz_tables_drop_db2.sql など、drop の用語が含まれるスクリプトは Quartz テーブルを作成する前に、drop が含まれるテーブルを除外します。

  2. Quartz 設定ファイル quartz-definition.properties を、JBOSS_HOME/MODE/configuration/ ディレクトリーに作成して、以下のサンプルコンテンツを追加します。

    #=========================================================================
    # 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)
注記

デフォルトでは、Quartz には 2 つのデータソースが必要です。

  • プロセスエンジンのトランザクションに参加する管理対象データソース。
  • トランザクション処理を行わずにトリガーするタイマーを検索するための管理対象外のデータソース。

Red Hat Process Automation Manager ビジネスアプリケーションでは、Quartz データベース (スキーマ) が Red Hat Process Automation Manager テーブルと共存することを想定しているので、Quartz のトランザクション操作に使用するデータソースを生成します。

他の (トランザクション以外) データソースを設定する必要がありますが、主なデータソースと同じデータベースを参照する必要があります。