Class DefaultQuartzJob
- java.lang.Object
-
- com.broadleafcommerce.scheduledjob.service.DefaultQuartzJob
-
- All Implemented Interfaces:
org.quartz.Job
public class DefaultQuartzJob extends Object implements 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'sJobExecutionContextto retrieve services on which to execute the job against, such as firing a message and updating theScheduledJobin the database.- Author:
- Chad Harchar (charchar), Jeff Fischer
-
-
Constructor Summary
Constructors Constructor Description DefaultQuartzJob()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(org.quartz.JobExecutionContext context)protected com.broadleafcommerce.data.tracking.core.TrackablemarkExecuted(ScheduledJob scheduledJob, ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository)Establish the job as having been executed and also mark the record withNotificationStatefor messaging resiliency related to the job trigger message.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.
-
-
-
Method Detail
-
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 protected com.broadleafcommerce.data.tracking.core.Trackable markExecuted(ScheduledJob scheduledJob, ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository)
Establish the job as having been executed and also mark the record withNotificationStatefor messaging resiliency related to the job trigger message.- Parameters:
scheduledJob- The job entityrepository- theNotificationStateRepository-implementing scheduled job repository- Returns:
- an updated job if updated, otherwise null
-
-