Class EmailSpamClassificationHandler
- Namespace
- MailFathom.Application.Spam
- Assembly
- MailFathom.Application.dll
Runs the classification of one message occurrence as a leased execution of the durable queue.
public sealed class EmailSpamClassificationHandler : IJobHandler
- Inheritance
-
EmailSpamClassificationHandler
- Implements
- Inherited Members
Remarks
The work is the use case that already exists, reached once per occurrence: the queue supplies the lease, the bounded attempts, the jittered backoff between them, and the dead letter that ends a job nothing can finish. That is the whole reason classification is a job rather than a step of the account's synchronization run — a scan reaches a sidecar that can be unreachable, saturated, or restarting, and a run that deferred the whole account could not express one message out of three hundred deserving another attempt.
Nothing here is a scheduler, a retry policy, or an idempotency identity of its own. The classification record carries no attempt count and no next-attempt time, because those are the queue row's and putting them on the record would be a job written in the wrong place.
Running it twice with one payload is the same as running it once, which is what the queue asks of every handler. The use case is keyed to the occurrence and asked to leave an existing record alone, and the changes a verdict asks of the mailbox are written under an identity of their own, so an attempt that crashed after committing its verdict leaves the next one with the same verdict to act on rather than with a second one to reach.
It reaches no mail server for the message it reads. Content comes from the local content store, so no classification
path opens an IMAP session and none can affect a remote \Seen flag; the one thing that does reach the mailbox
is a change an operator switched on, and that is written down as a durable mutation record for the account's own
convergence pass to carry.
Constructors
- EmailSpamClassificationHandler(IClassifiableEmailReader, IEmailSpamClassificationStore, EmailSpamClassifier, SpamActionRecorder)
Initializes the handler over the work one job describes.
Properties
- JobType
Gets the job type this handler runs, which is also the contract its payload arrives under.
Methods
- RunAsync(IJobPayload, CancellationToken)
Runs the work the payload describes.