Table of Contents

Interface IJobAttemptRunner

Namespace
MailFathom.Application.Jobs.Execution
Assembly
MailFathom.Application.dll

Runs one leased job in isolation from every other job running beside it.

public interface IJobAttemptRunner

Remarks

It exists because jobs run at once and JobExecutor writes through the persistence session of whatever scope resolved it. Two attempts sharing one session would use one database connection concurrently, which is neither safe nor detectable afterwards, so each attempt needs a scope of its own — and creating one is the composition root's to do rather than the application's.

The port is therefore narrow on purpose: it says what an attempt costs to start, and nothing about how work is claimed, bounded, timed, or recorded, all of which stays where the rest of the queue's policy is.

Methods

RunAsync(LeasedJob, CancellationToken)

Runs one job this process holds a lease on, and reports what the attempt did.