Table of Contents

Method RequirePermittedAsync

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

RequirePermittedAsync(OutgoingEmailRequest, CancellationToken)

Requires that this deployment may send the message a request describes.

public Task RequirePermittedAsync(OutgoingEmailRequest request, CancellationToken cancellationToken)

Parameters

request OutgoingEmailRequest

The send that was asked for.

cancellationToken CancellationToken

Cancels the period read.

Returns

Task

A task that completes when the send is permitted.

Remarks

The ceiling is read and judged rather than reserved, so two sends arriving together can both be admitted against one place left. The overshoot is bounded by the number of sends in flight at that instant, which is orders below what the ceiling exists to catch, and the alternative — a reservation released on every failure path between here and the commit — would refuse mail for a period whenever one of those paths was missed.

A request whose identity already has a record is judged the same way, which is what keeps the bounds a statement about the present rather than about whenever a caller first asked. That a full period can therefore refuse a retry of a send already recorded costs nothing: the record stands and its message is still delivered, and no answer here can produce a second one.

Exceptions

ArgumentNullException

Thrown when request is null.

OutgoingMailRefusedException

Thrown when sending is not enabled, a recipient is refused by the policy, or a ceiling is reached.