Interface ScheduledJobService<P extends ScheduledJob>

All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
All Known Implementing Classes:
DefaultScheduledJobService

public interface ScheduledJobService<P extends ScheduledJob> extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
Service reponsible for functionality related to ScheduledJob
Author:
Chad Harchar (charchar), Jeff Fischer
  • Method Summary

    Modifier and Type
    Method
    Description
    Establish the NotificationStateAware contract for TriggeredJobEventProducer.TYPE.
    executeJob(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Causes the specified ScheduledJob to be executed immediately.
    default P
    markJobAsExecuted(String contextId, TimingType timingType)
    Deprecated, for removal: This API element is subject to removal in a future version.
    markJobAsExecuted(String contextId, TimingType timingType, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Mark a job as executed via ScheduledJob.isExecuted().
    org.springframework.data.domain.Page<P>
    readAllByName(String name, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Read a page of job records focusing on name (optional)
    streamAll(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Read a stream of all ScheduledJobs in the data store.

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService

    create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService

    readAll, readAll, readAll, readAll
  • Method Details

    • streamAll

      @NonNull Stream<P> streamAll(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Read a stream of all ScheduledJobs in the data store.
      Parameters:
      contextInfo - context information surrounding multitenant state
      Returns:
      a stream of all ScheduledJobs in the data store
    • readAllByName

      @NonNull org.springframework.data.domain.Page<P> readAllByName(@Nullable String name, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Read a page of job records focusing on name (optional)
      Parameters:
      name - The name of the job to retrieve (optional)
      filters - Any additional search filters to apply
      page - The configuration for the page of records to retrieve
      context - The fetch view context
      Returns:
      The page of records
    • markJobAsExecuted

      @Nullable @Deprecated(forRemoval=true) default P markJobAsExecuted(@NonNull String contextId, @NonNull TimingType timingType)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Mark a job as executed via ScheduledJob.isExecuted(). As part of an atomic operation, this method should also set the ScheduledJob.getLastExecuted() field and disable the job via ScheduledJob.isEnabled() if the job is of TimingType.TARGET_DATE. Finally, the NotificationState of type TriggeredJobEventProducer.TYPE should be configured to start the resiliency lifecycle. See NotificationState for more information on the fields there related to messaging resiliency.
      Parameters:
      contextId - The tracking identifier for the scheduled job
      timingType - The type of job (e.g. whether it's recurring cron or single use)
      Returns:
      the updated job if found and successfully updated, otherwise null. For example, if another process had already updated the record as being executed, this update would not succeed.
    • markJobAsExecuted

      P markJobAsExecuted(@NonNull String contextId, @NonNull TimingType timingType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Mark a job as executed via ScheduledJob.isExecuted(). As part of an atomic operation, this method should also set the ScheduledJob.getLastExecuted() field and disable the job via ScheduledJob.isEnabled() if the job is of TimingType.TARGET_DATE. Finally, the NotificationState of type TriggeredJobEventProducer.TYPE should be configured to start the resiliency lifecycle. See NotificationState for more information on the fields there related to messaging resiliency.

      If ScheduledJob.isTrackExecutionDetails() is true, a new ScheduledJobExecutionDetail is also created. This is primarily used for tracking the execution details of a scheduledJob

      Parameters:
      contextId - The tracking identifier for the scheduled job
      timingType - The type of job (e.g. whether it's recurring cron or single use)
      context - the contextInfo
      Returns:
      the updated job if found and successfully updated, otherwise null. For example, if another process had already updated the record as being executed, this update would not succeed.
    • establishTriggerStateIfApplicable

      P establishTriggerStateIfApplicable(String contextId)
      Establish the NotificationStateAware contract for TriggeredJobEventProducer.TYPE. This should initialize the basic support for a trigger type NotificationState item in the NotificationStateAware.getNotificationStates() list. This state is generally completed during the markJobAsExecuted(String, TimingType) lifecycle.
      Parameters:
      contextId - The tracking identifier for the scheduled job
      Returns:
      The initialized entity instance
    • executeJob

      P executeJob(@NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Causes the specified ScheduledJob to be executed immediately.
      Parameters:
      id - The identifier for the scheduled job
      context - context information surrounding multitenant state
      Returns:
      The job that was executed