Table of Contents

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

session IPersistenceSession

The session the write joins.

lease OutgoingEmailLease

The lease the attempt holds the record under.

outgoingEmailId OutgoingEmailId

The record to give back.

availableAt DateTimeOffset

The instant from which the record may be claimed again.

failure MailFathomErrorCode?

The code identifying what ended the attempt, or null when it ended in no failure of its own and the recorded one stands.

cancellationToken CancellationToken

Cancels 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 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.