Class RecurringEventScheduler

java.lang.Object
com.iantapply.orchestra.schedule.RecurringEventScheduler
All Implemented Interfaces:
AutoCloseable

public final class RecurringEventScheduler extends Object implements AutoCloseable
Polls recurring definitions and uses distributed leases to emit each minute-level occurrence at most once across concurrently running nodes.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RecurringEventScheduler(com.iantapply.orchestra.port.DefinitionRepository definitions, OrchestratorEngine engine, com.iantapply.orchestra.port.DistributedLock locks, Clock clock)
    Creates a distributed recurring-event dispatcher.
    RecurringEventScheduler(com.iantapply.orchestra.port.DefinitionRepository definitions, OrchestratorEngine engine, com.iantapply.orchestra.port.DistributedLock locks, Clock clock, Consumer<String> failureCounter)
    Creates a scheduler with an operational failure counter sink.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Stops future recurring schedule checks.
    void
    Starts the recurring schedule poller once.
    static void
    validateSchedule(com.iantapply.orchestra.api.EventDefinition definition)
    Parses a definition's cron expression so invalid schedules fail during definition loading.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RecurringEventScheduler

      public RecurringEventScheduler(com.iantapply.orchestra.port.DefinitionRepository definitions, OrchestratorEngine engine, com.iantapply.orchestra.port.DistributedLock locks, Clock clock)
      Creates a distributed recurring-event dispatcher.
      Parameters:
      definitions - definitions containing optional recurring schedules
      engine - engine receiving scheduled executions
      locks - lease provider used to deduplicate occurrences
      clock - scheduler clock
    • RecurringEventScheduler

      public RecurringEventScheduler(com.iantapply.orchestra.port.DefinitionRepository definitions, OrchestratorEngine engine, com.iantapply.orchestra.port.DistributedLock locks, Clock clock, Consumer<String> failureCounter)
      Creates a scheduler with an operational failure counter sink.
      Parameters:
      definitions - definitions containing recurring schedules
      engine - engine receiving scheduled executions
      locks - lease provider used for occurrence deduplication
      clock - scheduler clock
      failureCounter - counter-name sink
  • Method Details

    • validateSchedule

      public static void validateSchedule(com.iantapply.orchestra.api.EventDefinition definition)
      Parses a definition's cron expression so invalid schedules fail during definition loading.
      Parameters:
      definition - definition to validate
    • start

      public void start()
      Starts the recurring schedule poller once.
    • close

      public void close()
      Stops future recurring schedule checks.
      Specified by:
      close in interface AutoCloseable