Class RecurringEventScheduler
java.lang.Object
com.iantapply.orchestra.schedule.RecurringEventScheduler
- All Implemented Interfaces:
AutoCloseable
Polls recurring definitions and uses distributed leases to emit each minute-level
occurrence at most once across concurrently running nodes.
-
Constructor Summary
ConstructorsConstructorDescriptionRecurringEventScheduler(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 TypeMethodDescriptionvoidclose()Stops future recurring schedule checks.voidstart()Starts the recurring schedule poller once.static voidvalidateSchedule(com.iantapply.orchestra.api.EventDefinition definition) Parses a definition's cron expression so invalid schedules fail during definition loading.
-
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 schedulesengine- engine receiving scheduled executionslocks- lease provider used to deduplicate occurrencesclock- 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 schedulesengine- engine receiving scheduled executionslocks- lease provider used for occurrence deduplicationclock- scheduler clockfailureCounter- 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:
closein interfaceAutoCloseable
-