Method ClaimAsync
- Namespace
- MailFathom.Application.Mail.Delivery
- Assembly
- MailFathom.Application.dll
ClaimAsync(OutgoingEmailClaimRequest, CancellationToken)
Takes up to a batch of the account's due sends and leases each of them to one attempt.
Task<IReadOnlyList<ClaimedOutgoingEmail>> ClaimAsync(OutgoingEmailClaimRequest request, CancellationToken cancellationToken)
Parameters
requestOutgoingEmailClaimRequestWhose sends to take, how many, and under what lease.
cancellationTokenCancellationTokenCancels the claim.
Returns
- Task<IReadOnlyList<ClaimedOutgoingEmail>>
The records this claim took, oldest first, each with the lease it is held under.
Remarks
Two things make a record due, and the second is the crash recovery: one at Recorded whose next-attempt instant has passed and is held by nobody, and one whose lease has run out. Nothing has to be told that a process died, because an expired lease is indistinguishable from one whose holder is gone.
A record at TransmissionBegun is never due, whatever its lease says. Its message may already be in somebody's mailbox and nothing an outbox can read afterwards says whether it is, so handing it to a second attempt is the one thing an expiry must not cause.
The attempt is counted by the claim rather than by whatever transmits, so a send that kills the process every time still reaches its bound instead of being attempted forever.
Exceptions
- ArgumentNullException
Thrown when
requestis null.