diff --git a/LiteCharms.Features/Quartz/JobOrchestrator.cs b/LiteCharms.Features/Quartz/JobOrchestrator.cs index 629365e..e8cb77a 100644 --- a/LiteCharms.Features/Quartz/JobOrchestrator.cs +++ b/LiteCharms.Features/Quartz/JobOrchestrator.cs @@ -18,6 +18,7 @@ public sealed class JobOrchestrator(ISchedulerFactory schedulerFactory) : IJobOr .WithDescription($"Correlation ID: {notification.CorrelationId}") .UsingJobData(new JobDataMap { ["Payload"] = JsonSerializer.Serialize(notification) }) .DisallowConcurrentExecution() + .RequestRecovery() .Build(); var trigger = global::Quartz.TriggerBuilder.Create() diff --git a/LiteCharms.Features/Quartz/MediatorJob.cs b/LiteCharms.Features/Quartz/MediatorJob.cs index 878d988..108b55c 100644 --- a/LiteCharms.Features/Quartz/MediatorJob.cs +++ b/LiteCharms.Features/Quartz/MediatorJob.cs @@ -8,6 +8,9 @@ public sealed class MediatorJob(IMediator mediator) : IJob where { public async Task Execute(IJobExecutionContext context) { + if (context.Recovering) + Trace.WriteLine($"CRITICAL RECOVERY: Resurrecting job '{typeof(TNotification).Name}' after a previous cluster node crashed mid-execution."); + var data = context.MergedJobDataMap["Payload"] as string; if (string.IsNullOrWhiteSpace(data))