Timers - redhat-consulting/jbpm-ee GitHub Wiki
Timers in jBPM are handled via Quartz. When a process moves to a Timer node, the job is passed off to Quartz. During that time, the process is moved out of memory and into the Quartz database. A Quartz service runs on each of the deployed Java EE Application Server. The Quartz service is cluster ready. Just to illustrate how the process works:
Timers Scheduling
The Workflow Processes move to a Timer node. At that point, a reference to the process and timer execution settings are persisted via the Quartz service to the Quartz database and in parallel the process is removed from memory and the process state (including variables) are persisted to the jBPM database.
By default, jBPM-EE is configured to:
- Coordinates the jBPM Process / jBPM Quartz writes to a single transaction
Timers Waiting
A global Quartz service continuously queries the jBPM Quartz tables. The following diagram illustrates that when no timers are set to execute, no processes are retained in server memory.
Timers Executing
When Quartz queries the jBPM Quartz tables and timers are "due" to be executed, the Quartz service passes the execution off to a pool of processor threads.
By default, jBPM-EE is configured to:
- Leverage 25 timer execution threads per cluster node
Frequently Asked Questions
- How does jBPM provide fail-over of Timer jobs?
- jBPM leverages Quartz, which has persisted job fail-over out of the box.
- How does jBPM provide load balancing of Timer jobs?
- jBPM leverages Quartz, which automatically load balances jobs out of the box.
- If a process is started on Cluster Node 1 and moves to a timer node, the process is persisted, and the timer job is passed to Quartz. Quartz may execute that timer job on any of the Cluster Nodes when the job is ready to fire.
Quartz Setting Details
- jBPM leverages Quartz 1.8.x
- jBPM-EE is preconfigured to take advantage of JobStoreCMT for coordinated JTA transactions
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreCMT
- jBPM-EE is preconfigured to leverage 25 execution threads for the Quartz jobs
org.quartz.threadPool.threadCount = 25
- jBPM-EE requires two datasources be provided for Quartz: an XA and non-XA Datasource, registered to:
- XA JNDI: java:/jdbc/jbpm-timers-xa
org.quartz.dataSource.jbpmDS.jndiURL=java:/jdbc/jbpm-timers-xa
- Non-XA JNDI: java:/jdbc/jbpm-timers-non-xa
org.quartz.dataSource.jbpmDSNoTx.jndiURL=java:/jdbc/jbpm-timers-non-xa
- XA JNDI: java:/jdbc/jbpm-timers-xa
- jBPM-EE is preconfigured to support clustering
org.quartz.jobStore.isClustered = true
For more details on Quartz, see: