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:

Base DispatchTaskExecutor

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.name and dispatch.task.executor.type OSGi component properties. See Creating a New Job Scheduler Task Executor to learn more.

DispatchTrigger

The DispatchTrigger interface extends DispatchTriggerModel and PersistedModel. This entity serves as a draft for a Liferay (Quartz) trigger. It is a connection between DispatchTaskExecutors and the Liferay scheduler engine.

DispatchMessageListener

The 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 (dispatchTriggerId). Using dispatchTriggerId, DispatchMessageListener finds and runs the appropriate instance of DispatchTaskExecutor using the DispatchTaskExecutorRegistry.

DispatchTaskExecutorRegistry

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

The DispatchLog interface extends DispatchLogModel and PersistedModel. This entity is responsible for persisting Job Scheduler task execution logs.

DispatchConfigurator

The DispatchConfigurator class defines properties of the Job Scheduler framework, such as the DispatchMessageListener destination, executorService queue size and thread pool, RejectedExecutionHandler, and more.

Capabilities

Product

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy