Class JobOrchestrationService

java.lang.Object
com.bluebell.greenhouse.radicle.services.job.JobOrchestrationService

@Service public class JobOrchestrationService extends Object
Application-facing facade that atomically persists complete executable job plans.
Version:
3.0.6
Author:
Stephen Prizio
  • 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 key
      payload - 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 key
      payload - job payload
      options - 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 type
      options - 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 key
      payload - job payload
      options - scheduling options
      Returns:
      committed submission