HerregistratieReminderJob (Quartz IJob) fires HerregistratieReminderSweep on a
daily cron wired in Big.Api (overridable via Quartz__Cron), and logs how many
reminders went out. Quartz.NET is used for this time-triggered fleet sweep,
distinct from the queue-draining pumps (ADR-0022). GET /registrations/{id} now
returns herregistratieVoor + herregistratieReminderVerstuurd. The scheduling
shell is excluded from mutation, mirroring the pumps.
refs #18
27 lines
1.2 KiB
C#
27 lines
1.2 KiB
C#
using Big.Application;
|
|
using Microsoft.Extensions.Logging;
|
|
using Quartz;
|
|
|
|
namespace Big.Infrastructure;
|
|
|
|
/// <summary>
|
|
/// The Quartz job that fires the herregistratie reminder sweep on a cron schedule (S-17, ADR-0022).
|
|
/// A deliberately thin shell — it resolves the pure <see cref="HerregistratieReminderSweep"/> (Quartz's
|
|
/// MS-DI job factory gives each fire its own scope) and logs how many reminders went out; all the
|
|
/// sweep logic is unit-tested in the application layer. Quartz drives this — rather than a
|
|
/// BackgroundService poll loop like the pumps — because it is a time-triggered fleet sweep, not a
|
|
/// queue to drain (the distinction recorded in ADR-0022). <see cref="DisallowConcurrentExecutionAttribute"/>
|
|
/// stops a slow sweep overlapping the next fire against the shared store.
|
|
/// </summary>
|
|
[DisallowConcurrentExecution]
|
|
public sealed class HerregistratieReminderJob(
|
|
HerregistratieReminderSweep sweep, ILogger<HerregistratieReminderJob> logger) : IJob
|
|
{
|
|
public async Task Execute(IJobExecutionContext context)
|
|
{
|
|
var reminded = await sweep.SweepAsync(context.CancellationToken);
|
|
logger.LogInformation(
|
|
"Herregistratie-sweep voltooid: {Count} herinnering(en) verstuurd.", reminded.Count);
|
|
}
|
|
}
|