Class TaskManagerService

java.lang.Object
org.tailormap.api.scheduling.TaskManagerService

@Service public class TaskManagerService extends Object
  • Constructor Details

    • TaskManagerService

      public TaskManagerService(@Autowired org.quartz.Scheduler scheduler)
  • Method Details

    • createTask

      public UUID createTask(Class<? extends org.springframework.scheduling.quartz.QuartzJobBean> job, TMJobDataMap jobData) throws org.quartz.SchedulerException
      Create a one-time job and schedule it to start immediately.
      Parameters:
      job - the task class to create
      jobData - a map with job data, the type and description keys are mandatory
      Returns:
      the task name, a hash of the description
      Throws:
      org.quartz.SchedulerException - if the job could not be scheduled
    • createTask

      public UUID createTask(Class<? extends org.springframework.scheduling.quartz.QuartzJobBean> job, TMJobDataMap jobData, String cronExpression) throws org.quartz.SchedulerException
      Create a job and schedule it with a cron expression.
      Parameters:
      job - the task class to create
      jobData - a map with job data, the type and description keys are mandatory
      cronExpression - the cron expression
      Returns:
      the task name, a UUID
      Throws:
      org.quartz.SchedulerException - if the job could not be scheduled
    • updateTask

      public void updateTask(org.quartz.JobKey jobKey, TMJobDataMap newJobData) throws org.quartz.SchedulerException
      Reschedule a task using updated job data.
      Parameters:
      jobKey - the job key
      newJobData - the new job data
      Throws:
      org.quartz.SchedulerException - if the job could not be rescheduled
    • getJobKey

      @Nullable public org.quartz.JobKey getJobKey(TaskType jobType, UUID uuid) throws org.quartz.SchedulerException
      Get the job key for a given type and uuid.
      Parameters:
      jobType - the type of the job
      uuid - the uuid of the job
      Returns:
      the job key
      Throws:
      org.quartz.SchedulerException - when the scheduler cannot be reached