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 configurationAddScheduler(scheduler => ...) inside AddTrax, where you declare schedules that are seeded when the application starts.
  2. Runtime APIITraxScheduler 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
Manifest ManagementDisableAsync, EnableAsync, TriggerAsync — runtime control of scheduled jobs
AddMetadataCleanupEnables automatic purging of old metadata for high-frequency trains

Helpers

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