Table of Contents

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

session IPersistenceSession

The session the write joins.

lease OutgoingEmailLease

The lease the attempt holds the record under.

outgoingEmailId OutgoingEmailId

The record to give back.

cancellationToken CancellationToken

Cancels 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 session or lease is 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.