This website uses cookies to ensure you get the best experience. Learn More.
Here are some key aspects of automation in Liferay 7.3 using the Dispatcher:
managing the Dispatcher. You can define rules, set up actions, manage triggers and events.
To use the `doExecute` method in Liferay's Dispatcher interface, you need to follow these steps:
public class MyTaskExecutor extends BaseDispatchTaskExecutor {
/**
* overiding the doExecute method
*/
@Override
public void doExecute(
DispatchTrigger dispatchTrigger,
DispatchTaskExecutorOutput dispatchTaskExecutorOutput)
throws IOException, PortalException {
//implement you task execution logic here
//this method will be called when the scheduled trigger is activated
//you can perform your desired tasks or invoke other methods or services
2. Configure the MyTaskExecutor properties: In the component annotation of the MyTaskExecutor class, you can specify the properties for scheduling the task.
@Component(
immediate = true,
property = {
"dispatch.task.executor.name=“+”TaskExecutor”,
"dispatch.task.executor.type="+” TaskExecutor “
},
service = DispatchTaskExecutor.class
)
Job Scheduler tasks are more flexible than jobs scheduled using MessageListener, because you can make changes to the tasks at runtime through the Job Scheduler UI. Changes to MessageListener jobs must be coded, compiled, and redeployed. The Job Scheduler UI also provides a more complete overview of each Job Scheduler task’s execution properties (e.g., Cron expression, start/end date, cluster mode) and execution history. This information is not provided in the UI for MessageListener jobs.