Method CancelAsync
- Namespace
- MailFathom.Application.Mail.Delivery.Operations
- Assembly
- MailFathom.Application.dll
CancelAsync(OutgoingEmailId, CancellationToken)
Withdraws one send that has not begun transmitting.
Task<OutboxDecisionOutcome> CancelAsync(OutgoingEmailId outgoingEmailId, CancellationToken cancellationToken)
Parameters
outgoingEmailIdOutgoingEmailIdThe send to cancel.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task<OutboxDecisionOutcome>
What happened to the send.
Remarks
It moves the record to Cancelled from Recorded and from nowhere else, which is the stage rule AdvanceAsync(IPersistenceSession, OutgoingEmailLease, OutgoingEmailId, OutgoingEmailStage, int?, CancellationToken) already states, read from the operator's end: nothing claims a withdrawal after bytes that may already have reached somebody.
A record a live lease holds is refused as well, even at that stage. Such a record is being attempted right now and may be one statement away from a transmission, so cancelling it would be a race whose losing side is a message the operator was told had been withdrawn.