Class DefaultQuartzJob
java.lang.Object
com.broadleafcommerce.scheduledjob.service.DefaultQuartzJob
- All Implemented Interfaces:
org.quartz.Job
A Quartz Job that gets executed when the target date or cron expression for the quartz scheduler
is hit. This uses Quartz's
JobExecutionContext to retrieve services on which to execute
the job against, such as firing a message and updating the ScheduledJob in the database.- Author:
- Chad Harchar (charchar), Jeff Fischer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(org.quartz.JobExecutionContext context) protected ScheduledJobmarkExecuted(@NonNull ScheduledJob scheduledJob, @NonNull ScheduledJobService<ScheduledJob> scheduledJobService) Establish the job as having been executed.protected com.broadleafcommerce.data.tracking.core.TrackablemarkExecuted(ScheduledJob scheduledJob, ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository) Deprecated, for removal: This API element is subject to removal in a future version.voidsendNotification(com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.Trackable notificationStateAware) Notify the system of the scheduled job trigger via theTriggeredJobEventProducer.
-
Constructor Details
-
DefaultQuartzJob
public DefaultQuartzJob()
-
-
Method Details
-
execute
public void execute(org.quartz.JobExecutionContext context) - Specified by:
executein interfaceorg.quartz.Job
-
sendNotification
public void sendNotification(com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.Trackable notificationStateAware) Notify the system of the scheduled job trigger via theTriggeredJobEventProducer.- Parameters:
notificationManager- TheNotificationManagerinstance responsible forTriggeredJobEventProducermessagingrepository- theNotificationStateRepository-implementing scheduled job repositorynotificationStateAware- the persisted-domain instance of the scheduled job for which to notify
-
markExecuted
@Nullable @Deprecated(forRemoval=true) protected com.broadleafcommerce.data.tracking.core.Trackable markExecuted(ScheduledJob scheduledJob, ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository) Deprecated, for removal: This API element is subject to removal in a future version.Establish the job as having been executed and also mark the record withNotificationStatefor messaging resiliency related to the job trigger message.Deprecated in favor of
markExecuted(ScheduledJob, ScheduledJobService)instead- Parameters:
scheduledJob- The job entityrepository- theNotificationStateRepository-implementing scheduled job repository- Returns:
- an updated job if updated, otherwise null
-
markExecuted
@Nullable protected ScheduledJob markExecuted(@NonNull @NonNull ScheduledJob scheduledJob, @NonNull @NonNull ScheduledJobService<ScheduledJob> scheduledJobService) Establish the job as having been executed. This also creates aScheduledJobExecutionDetailto track its execution details ifScheduledJob.isTrackExecutionDetails()istrue.This also mark the record with
NotificationStatefor messaging resiliency related to the job trigger message.- Parameters:
scheduledJob- The job entityscheduledJobService- the ScheduledJobService- Returns:
- an updated job if updated, otherwise null
-