Method DeferAsync
- Namespace
- MailFathom.Application.Mail.Delivery
- Assembly
- MailFathom.Application.dll
DeferAsync(IPersistenceSession, OutgoingEmailLease, OutgoingEmailId, DateTimeOffset, MailFathomErrorCode?, CancellationToken)
Gives a held record back after a failure that can clear, claimable again once the instant named has passed.
Task DeferAsync(IPersistenceSession session, OutgoingEmailLease lease, OutgoingEmailId outgoingEmailId, DateTimeOffset availableAt, MailFathomErrorCode? failure, CancellationToken cancellationToken)
Parameters
sessionIPersistenceSessionThe session the write joins.
leaseOutgoingEmailLeaseThe lease the attempt holds the record under.
outgoingEmailIdOutgoingEmailIdThe record to give back.
availableAtDateTimeOffsetThe instant from which the record may be claimed again.
failureMailFathomErrorCode?The code identifying what ended the attempt, or null when it ended in no failure of its own and the recorded one stands.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task
A task that completes when the record is given back.
Remarks
It returns the record to Recorded, which is the one place a stage moves backwards and is why the caller must have established that the message reached nobody it will be offered to again. An attempt that cannot establish that leaves the record where it is and records the failure instead.
A transmission the server acknowledged can end here too, and then no failure is recorded: the addresses it carried are settled, and what the next attempt offers is the ones the server refused for now.
Exceptions
- ArgumentNullException
Thrown when
sessionorleaseis null.- OutgoingEmailLeaseLostException
Thrown when the record is held by a later attempt.
- InvalidOperationException
Thrown when no record carries
outgoingEmailId, or when it has reached a terminal stage.