Method EnqueueAsync
- Namespace
- MailFathom.Application.Jobs
- Assembly
- MailFathom.Application.dll
EnqueueAsync(JobEnqueueRequest, CancellationToken)
Writes the execution down, reports the job that already carries this type and key, or refuses a queue that is full.
Task<JobEnqueueResult> EnqueueAsync(JobEnqueueRequest request, CancellationToken cancellationToken)
Parameters
requestJobEnqueueRequestThe execution to enqueue.
cancellationTokenCancellationTokenCancels the write or the read that follows a losing insert.
Returns
- Task<JobEnqueueResult>
What the queue did with the request, and the job it names when one exists.
Remarks
The job starts claimable, with no attempt counted and no lease, so enqueuing runs nothing by itself.
A queue holding as many jobs of this type as its configured depth allows refuses the request rather than accepting work nothing can drain, and says so as an outcome the caller acts on. The refusal is per job type, so a consumer that floods its own queue does not stop another consumer enqueuing; and a request whose identity is already queued is answered with that job rather than refused, because a retrying enqueuer needs to be told the work is there, not turned away from work it already produced.
Exceptions
- ArgumentNullException
Thrown when
requestis null.- JobPayloadTooLargeException
Thrown when the serialized payload exceeds the bound the enqueue boundary applies.