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'sJobExecutionContext
to retrieve services on which to execute the job against, such as firing a message and updating theScheduledJob
in 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 void
execute(org.quartz.JobExecutionContext context)
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 withNotificationState
for messaging resiliency related to the job trigger message.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
.
-
-
-
Method Detail
-
execute
public void execute(org.quartz.JobExecutionContext context)
- Specified by:
execute
in 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
- TheNotificationManager
instance responsible forTriggeredJobEventProducer
messagingrepository
- 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 withNotificationState
for 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
-
-