Scheduler API

The scheduler manages recurring and dependent trains through manifests, persistent records that define what train to run, when, and with what input. There are two contexts for scheduling:

  1. Startup configuration: AddScheduler(scheduler => ...) inside AddTrax, where you declare schedules that are seeded when the application starts.
  2. Runtime API: ITraxScheduler injected via DI, where you create/modify schedules dynamically at runtime.

Both share the same concepts: external IDs for upsert semantics, Schedule objects for timing, and ManifestOptions for per-job configuration.

Quick Reference

Setup & Configuration

MethodDescription
AddSchedulerAdds the scheduler subsystem and configures global options (polling, retries, timeouts)
ConfigureLocalWorkersCustomizes the built-in PostgreSQL local workers (enabled by default)
UseRemoteWorkersRoutes specific trains to a remote HTTP endpoint
TraxLambdaFunctionAWS Lambda base class for remote runners (Trax.Runner.Lambda package)

Scheduling Methods

MethodContextDescription
Schedule / ScheduleAsyncStartup / RuntimeSchedules a single recurring train
ScheduleMany / ScheduleManyAsyncStartup / RuntimeBatch-schedules manifests from a collection with optional pruning
Dependent SchedulingBothSchedules trains that run after a parent completes (ThenInclude, ThenIncludeMany, Include, IncludeMany, ScheduleDependentAsync, ScheduleManyDependentAsync)

Management

MethodDescription
ITraxSchedulerThe runtime scheduling interface: every method, plus TriggerGroupAsync and the dead-letter operations
Manifest ManagementDisableAsync, EnableAsync, TriggerAsync: runtime control of scheduled jobs
AddMetadataCleanupEnables automatic purging of old metadata for high-frequency trains
AddTraxSchedulerLivenessHealth check that fails when the JobDispatcher stops completing cycles
IOperationsServiceThe operations the dashboard and the GraphQL API share: queue a train, run one now, cancel a queued entry, edit group and scheduler settings
IWorkQueuePromotionConfirms entries staged by a deferred enqueue, and cancels or promotes stale ones. Defined in Trax.Effect.Data

Helpers

PageDescription
Scheduling HelpersEvery, Cron, Schedule record, and ManifestOptions: the building blocks for defining when and how jobs run