Understanding the Job Scheduler Framework
Liferay Job Scheduler is a flexible framework built on top of Liferay’s Scheduler Engine. You can use it to add, execute, and schedule tasks containing any custom logic across a Liferay instance.
The Job Scheduler framework consists of six essential parts:
Implementations of the base
DispatchTaskExecutor interface create templates for Job Scheduler Tasks in a Liferay instance. Each implementation of
DispatchTaskExecutor is registered as an OSGi component and contains the logic executed by the Job Scheduler task. All Job Scheduler tasks are instances of Java classes that implement the
DispatchTaskExecutor interface and have the
dispatch.task.executor.type OSGi component properties. See Creating a New Job Scheduler Task Executor to learn more.
DispatchTrigger interface extends
PersistedModel. This entity serves as a draft for a Liferay (Quartz) trigger. It is a connection between
DispatchTaskExecutors and the Liferay scheduler engine.
DispatchMessageListener class initiates the execution of all Job Scheduler Task Executors. This means a new Liferay trigger is created for each scheduled instance of the
DispatchTaskExecutor service class. This trigger is created with the same destination (
liferay/dispatch/executor) and has a payload (
dispatchTriggerId) that connects the Liferay trigger with
DispatchTaskExecutor. The Liferay Scheduler engine then triggers
DispatchMessageListener at the appropriate time with a message (
DispatchMessageListener finds and runs the appropriate instance of
DispatchTaskExecutor using the
Implementations of the
DispatchTaskExecutorRegistry interface hold references to all implementations of
DispatchTaskExecutor in the portal and validate that each
dispatch.task.executor.type OSGi property value is unique.
DispatchLog interface extends
PersistedModel. This entity is responsible for persisting Job Scheduler task execution logs.
DispatchConfigurator class defines properties of the Job Scheduler framework, such as the
executorService queue size and thread pool,
RejectedExecutionHandler, and more.