Package org.tailormap.api.scheduling
Class TaskManagerService
java.lang.Object
org.tailormap.api.scheduling.TaskManagerService
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateTask
(Class<? extends org.springframework.scheduling.quartz.QuartzJobBean> job, TMJobDataMap jobData) Create a one-time job and schedule it to start immediately.createTask
(Class<? extends org.springframework.scheduling.quartz.QuartzJobBean> job, TMJobDataMap jobData, String cronExpression) Create a job and schedule it with a cron expression.org.quartz.JobKey
Get the job key for a given type and uuid.void
updateTask
(org.quartz.JobKey jobKey, TMJobDataMap newJobData) Reschedule a task using updated job data.
-
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 createjobData
- a map with job data, thetype
anddescription
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 createjobData
- a map with job data, thetype
anddescription
keys are mandatorycronExpression
- 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 keynewJobData
- 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 jobuuid
- the uuid of the job- Returns:
- the job key
- Throws:
org.quartz.SchedulerException
- when the scheduler cannot be reached
-