Class 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'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 Detail

      • DefaultQuartzJob

        public DefaultQuartzJob()
    • Method Detail

      • execute

        public void execute​(org.quartz.JobExecutionContext context)
        Specified by:
        execute in interface org.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 the TriggeredJobEventProducer.
        Parameters:
        notificationManager - The NotificationManager instance responsible for TriggeredJobEventProducer messaging
        repository - the NotificationStateRepository-implementing scheduled job repository
        notificationStateAware - 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 with NotificationState for messaging resiliency related to the job trigger message.
        Parameters:
        scheduledJob - The job entity
        repository - the NotificationStateRepository-implementing scheduled job repository
        Returns:
        an updated job if updated, otherwise null