Table of Contents

Method AdvanceAsync

Namespace
MailFathom.Application.Mail.Delivery
Assembly
MailFathom.Application.dll

AdvanceAsync(IPersistenceSession, OutgoingEmailLease, OutgoingEmailId, OutgoingEmailStage, int?, CancellationToken)

Moves the record to a terminal stage, recording the reply the server answered the transmission with.

Task AdvanceAsync(IPersistenceSession session, OutgoingEmailLease lease, OutgoingEmailId outgoingEmailId, OutgoingEmailStage stage, int? replyCode, 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 advance.

stage OutgoingEmailStage

The terminal stage the send has reached.

replyCode int?

The reply code the server answered the message with, or null when it answered none.

cancellationToken CancellationToken

Cancels the write.

Returns

Task

A task that completes when the stage is written.

Remarks

A terminal stage is the only thing this writes, because every non-terminal stage is reached by a transition of its own.

Two of the three follow one stage only, which is the unknown window read from either end. Sent follows only TransmissionBegun, so no record claims a delivery it never recorded a transmission for; Cancelled follows only Recorded, so no record claims a withdrawal after bytes that may already have reached somebody. A send stopped mid-transmission therefore reaches none of the three: it stays at TransmissionBegun, stamped with OutgoingEmailOutcomeUnknown by the sweep this store runs before it claims, and nothing claims it again. Every terminal stage states something about what was received, and that is the one thing nobody can read there.

Exceptions

ArgumentNullException

Thrown when session or lease is null.

OutgoingEmailLeaseLostException

Thrown when the record is held by a later attempt.

ArgumentOutOfRangeException

Thrown when stage is not a terminal stage, or when replyCode is supplied and is not a three-digit reply code.

InvalidOperationException

Thrown when no record carries outgoingEmailId, when it has already reached a terminal stage, or when the stage asked for does not follow the one the record reached.