Class JobOrchestrationService
java.lang.Object
com.bluebell.greenhouse.radicle.services.job.JobOrchestrationService
Application-facing facade that atomically persists complete executable job plans.
- Version:
- 3.0.6
- Author:
- Stephen Prizio
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends JobPayload>
JobSubmissionscheduleJob(JobDefinitionKey<T> key, T payload) Schedules a typed job with default options.<T extends JobPayload>
JobSubmissionscheduleJob(JobDefinitionKey<T> key, T payload, JobScheduleOptions options) Schedules a typed job and atomically persists every action before execution can begin.scheduleJobIfDue(JobType jobType) Schedules a parameter-free job unless it is inside its cooldown window.<T extends JobPayload>
Optional<JobSubmission> scheduleJobIfDue(JobDefinitionKey<T> key, T payload, JobScheduleOptions options) Schedules a typed job unless the type ran, or is running, inside its cooldown window.scheduleJobIfIdle(JobType jobType, JobScheduleOptions options) Schedules a parameter-free job unless work of that type is already committed.
-
Constructor Details
-
JobOrchestrationService
public JobOrchestrationService()
-
-
Method Details
-
scheduleJob
@Transactional(propagation=REQUIRES_NEW) public <T extends JobPayload> JobSubmission scheduleJob(JobDefinitionKey<T> key, T payload) Schedules a typed job with default options.- Type Parameters:
T- payload type- Parameters:
key- typed definition keypayload- job payload- Returns:
- committed submission
-
scheduleJobIfDue
@Transactional(propagation=REQUIRES_NEW) public <T extends JobPayload> Optional<JobSubmission> scheduleJobIfDue(JobDefinitionKey<T> key, T payload, JobScheduleOptions options) Schedules a typed job unless the type ran, or is running, inside its cooldown window.- Type Parameters:
T- payload type- Parameters:
key- typed definition keypayload- job payloadoptions- scheduling options- Returns:
- the committed submission, or empty when the run was skipped
-
scheduleJobIfDue
@Transactional(propagation=REQUIRES_NEW) public Optional<JobSubmission> scheduleJobIfDue(JobType jobType) Schedules a parameter-free job unless it is inside its cooldown window.- Parameters:
jobType- job type- Returns:
- the committed submission, or empty when the run was skipped
-
scheduleJobIfIdle
@Transactional(propagation=REQUIRES_NEW) public Optional<JobSubmission> scheduleJobIfIdle(JobType jobType, JobScheduleOptions options) Schedules a parameter-free job unless work of that type is already committed. Unlike a scheduled tick this ignores the cooldown window, because the caller is reacting to new work arriving rather than to the clock.- Parameters:
jobType- job typeoptions- scheduling options- Returns:
- the committed submission, or empty when work was already in flight
-
scheduleJob
@Transactional(propagation=REQUIRES_NEW) public <T extends JobPayload> JobSubmission scheduleJob(JobDefinitionKey<T> key, T payload, JobScheduleOptions options) Schedules a typed job and atomically persists every action before execution can begin.- Type Parameters:
T- payload type- Parameters:
key- typed definition keypayload- job payloadoptions- scheduling options- Returns:
- committed submission
-