One-off Scheduling
A one-off job runs once (plus its retries, if it fails). This page goes deeper than Scheduling Jobs: what you can pass when scheduling, and where each setting comes from when you don't pass it.
When to Run
await scheduler.OnceNowAsync<ReportHandler>(msg); // as soon as a worker picks it up
await scheduler.OnceAfterAsync<ReportHandler>(TimeSpan.FromMinutes(5), msg); // after a delay, counted from now
await scheduler.OnceAtAsync<ReportHandler>(new DateTime(2026, 12, 24, 18, 0, 0, DateTimeKind.Utc), msg); // at a time, in UTC
Each one also has a synchronous version: OnceNow, OnceAfter and OnceAt.
Message Data
Message data is the job's payload: the values the handler needs to do its work.
var msg = WriteableMessageData.New()
.SetStringValue("CustomerEmail", "john@example.com")
.SetLongValue("OrderId", 9876543210L)
.SetDecimalValue("Amount", 99.99m)
.SetBoolValue("SendReceipt", true)
.SetJson("Address", new Address { City = "Lisbon", Country = "PT" });
public async Task HandleAsync(JobContext job)
{
var email = job.MsgData.GetStringValue("CustomerEmail"); // throws if missing
var sendReceipt = job.MsgData.TryGetBoolValue("SendReceipt"); // null if missing
var address = job.MsgData.TryGetJson<Address>("Address");
}
There's a Set… / Get… / TryGet… method for each common type (string, numbers, bool, DateTime, Guid, enums, byte arrays) and SetJson / GetJson for objects. Keys ignore case: "orderId" reads the value set as "OrderId".
Keep it small: store ids and load the rest in the handler. Message data and metadata together are limited to 128 KiB per job by default (the cluster's MaxMessageByteSize); a bigger job is rejected when you schedule it.
Metadata
Metadata is information about the job rather than its input: a category, a tenant, a correlation id. You can filter jobs by metadata on the dashboard and in the API.
var metadata = WritableMetadata.New()
.SetStringValue("Tenant", "acme")
.SetStringValue("CorrelationId", correlationId);
await scheduler.OnceNowAsync<ReportHandler>(msg, metadata: metadata);
Metadata can also be set on the handler with [JobMasterMetadata("Category", "Reports")]. Metadata passed on the call overrides the attribute key by key: for the same key the call wins, and keys set in only one of them are all kept. Keys ignore case here too.
Read it in the handler with job.Metadata.TryGetStringValue("Tenant").
The dashboard's jobs list (and recurring schedules list) shows only the metadata keys that start with !, as key=value badges in its Metadata column, for example .SetStringValue("!Tenant", "acme"). The ! is part of the key, so read it back as "!Tenant". Every key, with or without !, is shown on the job's detail page.
Options on the Call
Every scheduling method takes the same optional parameters, after the message data:
| Parameter | Sets |
|---|---|
clusterId | The cluster the job goes to (see Several Clusters) |
priority | JobMasterPriority: VeryLow, Low, Medium, High, Critical |
workerLane | The worker lane the job runs in |
timeout | How long a run may take |
maxNumberOfRetries | How many times a failed run is retried |
metadata | The job's metadata |
await scheduler.OnceNowAsync<ReportHandler>(
msg,
priority: JobMasterPriority.High,
timeout: TimeSpan.FromMinutes(10));
Where Each Setting Comes From
A setting you don't pass on the call comes from the handler's attribute, and without an attribute from the cluster's default, or JobMaster's own default where the cluster has no setting for it:
| Setting | 1. Call | 2. Handler attribute | 3. Default |
|---|---|---|---|
| Cluster | clusterId: | [JobMasterClusterId] | The default cluster |
| Priority | priority: | [JobMasterPriority] | Medium |
| Timeout | timeout: | [JobMasterTimeout] | The cluster's DefaultJobTimeout; 1 minute if the cluster doesn't set it |
| Retries | maxNumberOfRetries: | [JobMasterMaxNumberOfRetries] | The cluster's DefaultMaxRetryCount; 3 if the cluster doesn't set it |
| Worker lane | workerLane: | [JobMasterWorkerLane] | No lane |
| Metadata | metadata: | [JobMasterMetadata] | None; call and attribute are merged key by key |
So you can put sensible defaults on the handler and override them only where a call needs something else:
[JobMasterPriority(JobMasterPriority.Low)]
[JobMasterTimeout(30)] // seconds
public sealed class ReportHandler : IJobMasterHandler { ... }
await scheduler.OnceNowAsync<ReportHandler>(msg); // Low, 30 s
await scheduler.OnceNowAsync<ReportHandler>(msg, priority: JobMasterPriority.High); // High, 30 s
The handler attributes are covered in Job Configuration, the cluster defaults in Cluster Basics.
Several Clusters
An app can be connected to more than one cluster. A job goes to:
- the
clusterIdpassed on the call, or - the handler's
[JobMasterClusterId("...")], or - the default cluster.
await scheduler.OnceNowAsync<InvoiceHandler>(msg, clusterId: "billing-cluster");
Cluster ids ignore case. The cluster must be configured in the app: an unknown id on a handler attribute fails at startup, and on the call it throws.
Next
Recurring Schedule: schedules created from code, profiles and the recurrence engines.