Method SubmitAsync
- Namespace
- MailFathom.Application.Spam.Runs
- Assembly
- MailFathom.Application.dll
SubmitAsync(MailAccountId, SpamClassificationRunTerms, CancellationToken)
Asks for every message stored for the account to be classified on the terms given.
public Task<SpamClassificationRunRequest> SubmitAsync(MailAccountId accountId, SpamClassificationRunTerms terms, CancellationToken cancellationToken)
Parameters
accountIdMailAccountIdThe account to walk.
termsSpamClassificationRunTermsWhat the run should do.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task<SpamClassificationRunRequest>
The run the account now has outstanding, and whether this request is what put it there.
Remarks
The read and the write are one committed decision rather than a check followed by an insert, because two requests arriving together must resolve to one run. The loser of that race meets the account's own key, is retried from a fresh read, and is answered with the run the winner asked for.
A run asked to act moves mail on somebody's server, so the grant it asks for is the one covering work the deployment performs on request — reading what a run concluded is a different grant and neither implies the other.
Exceptions
- ArgumentNullException
Thrown when
termsis null.- PersistenceConcurrencyConflictException
Thrown when two requests raced past the bounded retries.
- PrincipalNotAuthorizedException
Thrown when the use case was reached by anything but a caller granted AdminOperate.
- OperationCanceledException
Thrown when the caller cancels.