Method ReleaseAsync
- Namespace
- MailFathom.Application.Mail.Delivery
- Assembly
- MailFathom.Application.dll
ReleaseAsync(IPersistenceSession, OutgoingEmailLease, OutgoingEmailId, CancellationToken)
Gives a held record back unfinished, so it is claimable again at once and holds no attempt against it.
Task ReleaseAsync(IPersistenceSession session, OutgoingEmailLease lease, OutgoingEmailId outgoingEmailId, CancellationToken cancellationToken)
Parameters
sessionIPersistenceSessionThe session the write joins.
leaseOutgoingEmailLeaseThe lease the attempt holds the record under.
outgoingEmailIdOutgoingEmailIdThe record to give back.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task
A task that completes when the record is given back.
Remarks
It is the shutdown path and nothing else: a host that stopped before an attempt transmitted anything cost the send nothing, so the attempt the claim counted is given back with it. Like DeferAsync(IPersistenceSession, OutgoingEmailLease, OutgoingEmailId, DateTimeOffset, MailFathomErrorCode?, CancellationToken) it returns the record to Recorded, and for the same reason it may only be called by an attempt that established that nothing was transmitted.
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.