Class SpamClassificationArrivals
- Namespace
- MailFathom.Application.Spam
- Assembly
- MailFathom.Application.dll
Asks for a classification of each message synchronization has just committed.
public sealed class SpamClassificationArrivals
- Inheritance
-
SpamClassificationArrivals
- Inherited Members
Remarks
This is the whole arrival trigger. It is reached once per stored message, after the transaction that stored the message and its content has committed, and it writes one row into the durable queue — where the work is leased, retried per message, and made idempotent by the queue's own model rather than by anything here.
A message stored without its content is deliberately not asked for. Classification reads the local content store and reports a message it cannot read as unclassifiable rather than fetching it, so enqueuing one would spend a lease to reach an answer that is already known — and the gate over derived work already releases such a message rather than holding it.
The two cheap questions are asked before the row is written, in the order they cost: whether classification runs at all, and whether the configured scope covers the folder the message arrived in. A deployment with classification off therefore performs one property read per stored message and reaches no queue, which is the same shape every other path through this feature has when it is switched off.
What the queue answers is not acted on, and that is the bound the synchronization run needs. A row this call wrote, a row an earlier attempt already wrote, and a refusal because the queue holds as much of this type as the deployment accepts are all the same thing here: the message is stored, and a classification either happens or the wait a verdict is allowed releases the message to derived work without one. A refusal is visible as the queue depth standing at its configured bound, which is where backpressure is read from rather than from anything this type records.
Nothing from the message reaches the queue. The payload names the occurrence and the idempotency key is the message's own stored identity, so an operator reading a stuck job sees where the message is and can ask what was concluded about it, and neither carries a subject, an address, or anything else out of the mail.
Constructors
- SpamClassificationArrivals(IJobStore, ISpamClassificationSettingsReader)
Initializes the trigger over the queue it writes to and the settings that decide whether it does.
Methods
- ScheduleAsync(StoredEmailId, EmailOccurrenceId, CancellationToken)
Asks for one committed message to be classified.