[PersistJobDataAfterExecution]
[DisallowConcurrentExecution]
public class HeartBeatJob : IJob
{
public int? LastCount { get; set; }
public Task Execute(IJobExecutionContext context)
{
var lastRun = context.PreviousFireTimeUtc?.DateTime.ToString(CultureInfo.InvariantCulture) ?? string.Empty;
if (!LastCount.HasValue)
{
LastCount = 1;
}
context.JobDetail.JobDataMap["LastCount"]=LastCount;
Log.Information("HeartBeat. Previous run: {lastRun} UTC, LastCount: {LastCount}", lastRun,LastCount);
LastCount++;
return Task.CompletedTask;
}
}
When started - job increments LastCount between runs as expected
When job map is changed through trigger editing page, incrementing of LastCount does not work.
Job is codded as follows:
When started - job increments LastCount between runs as expected When job map is changed through trigger editing page, incrementing of LastCount does not work.