Method ClaimAsync
- Namespace
- MailFathom.Application.Jobs
- Assembly
- MailFathom.Application.dll
ClaimAsync(JobClaimRequest, CancellationToken)
Takes up to a batch of due jobs this process can run, and leases each of them to one attempt.
Task<IReadOnlyList<LeasedJob>> ClaimAsync(JobClaimRequest request, CancellationToken cancellationToken)
Parameters
requestJobClaimRequestWhich types this process runs, how many to take, and under what lease.
cancellationTokenCancellationTokenCancels the claim.
Returns
- Task<IReadOnlyList<LeasedJob>>
The jobs this call took, oldest first, and an empty answer when none was due.
Remarks
A job is due when it is pending and its available instant has passed, or when it is claimed under a lease that has expired. The second is what makes a crash recoverable: work in flight when a process died is taken by the next claim without an operator doing anything.
Ordering is best effort. The statement hands a worker the next available row, so work that must happen in a fixed order relative to other work cannot express that through this queue.
Exceptions
- ArgumentNullException
Thrown when
requestis null.