Configuration
The optional RecurringJobs section adjusts what the attribute scan found, so a job can be scheduled differently per environment without a rebuild. It is read only when RegisterRecurringJobs is passed an IConfiguration.
{
"RecurringJobs": {
"EnabledByDefault": true,
"Jobs": {
"cleanup-expired-sessions": {
"Enabled": false,
"CronExpression": "0 4 * * *",
"TimeZone": "Europe/Amsterdam",
"Queue": "maintenance"
}
}
}
}RecurringJobSettings
The RecurringJobs section itself. Every value has a default, so the section may be absent and an application that schedules the same jobs everywhere never needs it.
Fields
EnabledByDefault: bool
Whether a job whose attribute does not state either way is scheduled. Set it to false in one environment to park everything except the jobs that opt in explicitly.
Default: true
Jobs: IReadOnlyDictionary<string, RecurringJobOverride>
Per-job overrides keyed by job id, matched ignoring case. A key naming a job the scan did not find stops the host, since that is nearly always a typo.
Default: {}
RecurringJobOverride
One entry under Jobs, replacing what a single job's attribute declares. Every value is optional and an omitted one keeps the declared one, so an entry only names what changes.
Fields
Enabled: bool?
Whether the job is scheduled, outranking both the attribute and EnabledByDefault.
Default: null
CronExpression: string?
Cron expression to schedule with instead of the declared one. Validated exactly like a declared expression, so a bad value here stops the host.
Default: null
TimeZone: string?
Time zone to evaluate the expression in instead of the declared one. It cannot be cleared back to UTC, because an omitted value means the attribute wins.
Default: null
Queue: string?
Queue to enqueue on instead of the declared one, for steering a job onto a queue only some environments have a server listening on.
Default: null