第4章 Quartz タイマーサービスの設定
クラスターで Process Server を実行する場合には、Quartz タイマーサービスを設定する必要があります。
アプリケーションサーバーでデータベースを設定する前に、Quartz テーブルを作成するために Quarts データベースを準備する必要があります。このデータベースで、タイマーデータと Quartz 定義ファイルを保持します。
前提条件
- サポートのある JTA 以外のデータソース (例: PostgreSQL データソースなど) は、アプリケーションサーバーに接続されている。
手順
データベースに Quartz テーブルを作成し、お使いのデータベース用の DDL スクリプトを使用してタイマーイベントが同期できるようにします。
DDL スクリプトは、
QUARTZ_HOME/docs/dbTables
に展開した、補足用の Zip アーカイブにあります。Quartz 設定ファイルを
JBOSS_HOME/MODE/configuration/
ディレクトリーの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
属性に設定されています。システムへのパフォーマンスの影響を考慮し、必要に応じて設定を変更してください。-
org.quartz.properties
プロパティーのquartz-definition.properties
ファイルに絶対パスを指定します。 オプション: 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 のトランザクション操作に使用するデータソースを生成します。
他の (トランザクション以外) データソースを設定する必要がありますが、主なデータソースと同じデータベースを参照する必要があります。