Job Executor

The Job Executor is a key component responsible for managing and executing asynchronous jobs within the process engine. It handles tasks such as timers, asynchronous continuations, and other background processes that need to be executed outside the main process flow. By offloading these tasks, the job executor ensures that the main execution thread remains responsive and efficient.

The job executor operates in a multithreaded environment, allowing it to process multiple jobs concurrently. It retrieves jobs from the database, executes them, and updates their status accordingly. This mechanism is essential for implementing features like delayed tasks and scheduled events in business processes.

Overall, the job executor enhances the performance and scalability of the process engine by efficiently managing background jobs and ensuring smooth process execution.

Job Types

There are two primary types of jobs managed by the job executor:

  • Timer Jobs: These are scheduled to trigger at specific times, often associated with boundary events in BPMN models.

  • Async Jobs: Created when a task is marked with the flowable:async="true" attribute, indicating that it should be executed asynchronously.

Execution Flow

  • When a process instance reaches a point where an async job or timer is necessary, the job executor inserts a corresponding entry into the ACT_RU_JOB table.

  • For timer jobs, a thread periodically checks for jobs that are due and triggers them accordingly.

  • For async jobs, once an API call that creates the job is successfully committed, a transaction listener activates the job executor to execute the job.