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

| Method | Description | |——–|————-| | AddScheduler | Adds the scheduler subsystem and configures global options (polling, retries, timeouts) | | ConfigureLocalWorkers | Customizes the built-in PostgreSQL local workers (enabled by default) | | UseRemoteWorkers | Routes specific trains to a remote HTTP endpoint | | TraxLambdaFunction | AWS Lambda base class for remote runners (Trax.Runner.Lambda package) |

Scheduling Methods

Method Context Description
Schedule / ScheduleAsync Startup / Runtime Schedules a single recurring train
ScheduleMany / ScheduleManyAsync Startup / Runtime Batch-schedules manifests from a collection with optional pruning
Dependent Scheduling Both Schedules trains that run after a parent completes (ThenInclude, ThenIncludeMany, Include, IncludeMany, ScheduleDependentAsync, ScheduleManyDependentAsync)

Management

Method Description
Manifest Management DisableAsync, EnableAsync, TriggerAsync: runtime control of scheduled jobs
AddMetadataCleanup Enables automatic purging of old metadata for high-frequency trains

Helpers

Page Description
Scheduling Helpers Every, Cron, Schedule record, and ManifestOptions: the building blocks for defining when and how jobs run

Table of contents


Back to top

Trax - A .NET framework for Railway Oriented Programming with Effects, Scheduling, and more