Interface IOutgoingMailUsageReader
- Namespace
- MailFathom.Application.Mail.Delivery.Governance
- Assembly
- MailFathom.Application.dll
Counts what one period has already been asked to send, for an account and for the deployment.
public interface IOutgoingMailUsageReader
Remarks
Durable rather than held in memory, because the fault a ceiling exists to bound is precisely the one an in-process counter cannot see: a process that crashes and restarts in a loop would begin every period again from nothing and send the whole ceiling on each attempt.
It is counted from the outgoing records themselves rather than from a ledger beside them. A record is written for every send this deployment is asked for, under the idempotency identity that makes the same request twice one record, so counting them is exact where a second counter would have to be told which enqueues were new — and a retried send that charged a ceiling twice would refuse mail nobody asked to send.
Methods
- ReadUsageSinceAsync(MailAccountId, DateTimeOffset, CancellationToken)
Reads what has been asked to leave since a period began.