Skip to content

IJobShard.TryScheduleJobAsync(ScheduleJobRequest, CancellationToken)

TryScheduleJobAsync(ScheduleJobRequest, CancellationToken)

abstract
public abstract Task<DurableJob?> TryScheduleJobAsync(ScheduleJobRequest request, CancellationToken cancellationToken)
Attempts to schedule a new job on this shard.

Parameters

requestScheduleJobRequest
The request containing the job scheduling parameters.
cancellationTokenCancellationToken
A token to cancel the operation.

Returns

A task that represents the asynchronous operation. The task result contains the durable job if successful, or null if the job could not be scheduled (e.g., the shard was marked as complete).

Exceptions

System.ArgumentOutOfRangeException
Thrown when the due time is outside the shard's time range.