MftScheduler
Defined in: src/mft/MftScheduler.ts:106
Runs routes on configured schedules.
Subscribes to a ScheduleRegistry, computes the next fire time for
each schedule (cron or interval), and dispatches the matching route through
a runner of your choice (runRoute by default, or a wrapped runner for
approvals / rate limiting / circuit breaking). Observers fire on each cycle
for telemetry. Tests can inject a deterministic timer via timer.
Example
Section titled “Example”import { ApprovalRegistry, InMemoryAuditLog, MftScheduler, RouteRegistry, ScheduleRegistry, createApprovalGate, runRoute,} from "@zero-transfer/sdk";
const audit = new InMemoryAuditLog();const approvals = new ApprovalRegistry();
const scheduler = new MftScheduler({ client, routes: new RouteRegistry([route]), schedules: new ScheduleRegistry([ { id: "nightly", routeId: route.id, cron: "0 2 * * *" }, ]), runner: createApprovalGate({ registry: approvals, approvalId: ({ route }) => `release:${route.id}`, runner: ({ client: c, route: r, signal }) => runRoute({ client: c, route: r, signal }), }), onResult: ({ receipt }) => audit.record({ type: "transfer.success", receipt }), onError: ({ error }) => audit.record({ type: "transfer.failure", error }),});
scheduler.start();Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MftScheduler(options: MftSchedulerOptions): MftScheduler;Defined in: src/mft/MftScheduler.ts:121
Creates a scheduler bound to a transfer client and registries.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | MftSchedulerOptions | Client, registries, optional runner, observers, and timer hooks. |
Returns
Section titled “Returns”MftScheduler
Accessors
Section titled “Accessors”isRunning
Section titled “isRunning”Get Signature
Section titled “Get Signature”get isRunning(): boolean;Defined in: src/mft/MftScheduler.ts:132
Whether the scheduler is currently running.
Returns
Section titled “Returns”boolean
Methods
Section titled “Methods”start()
Section titled “start()”start(): void;Defined in: src/mft/MftScheduler.ts:137
Starts the scheduler. No-op when already running.
Returns
Section titled “Returns”void
stop()
Section titled “stop()”stop(): Promise<void>;Defined in: src/mft/MftScheduler.ts:152
Stops the scheduler and aborts in-flight route executions.
Returns
Section titled “Returns”Promise<void>
A promise that resolves once all in-flight fires have settled.