Describe the bug
When we use MicrosoftDependencyInjectionJobFactory we cannot inject properties from JobDataMap coming from triggers. I can see that job properties are empty at the moment of job execution
Version used
3.2.4
To Reproduce
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Quartz;
namespace ConsoleQuartzIssue
{
class Program
{
static async Task Main(string[] args)
{
var services = new ServiceCollection();
services.AddLogging(x => x.AddConsole());
services.AddTransient<TestRunJob>();
services.AddQuartz(x => x.UseMicrosoftDependencyInjectionScopedJobFactory());
var serviceProvider = services.BuildServiceProvider();
var schedulerFactory = serviceProvider.GetRequiredService<ISchedulerFactory>();
var scheduler = await schedulerFactory.GetScheduler();
var job = JobBuilder.Create<TestRunJob>()
.WithIdentity(JobKey.DefaultGroup)
.RequestRecovery(false)
.Build();
var trigger = TriggerBuilder.Create()
.StartNow()
.UsingJobData(nameof(TestRunJob.Prop), "test value")
.Build();
await scheduler.ScheduleJob(job, trigger);
await scheduler.Start();
Console.ReadKey();
}
}
internal class TestRunJob : IJob
{
public string Prop { get; set; }
public Task Execute(IJobExecutionContext context)
{
Console.WriteLine($"Prop value : {Prop}");
Console.WriteLine($"Prop value from MergedJobDataMap: {context.MergedJobDataMap[nameof(Prop)]}");
return Task.CompletedTask;
}
}
}
Expected behavior
Fields filled with data mentioned in trigger JobDataMap
Additional context
According to my observations MergedJobDataMap contains the specified properties
Describe the bug
When we use MicrosoftDependencyInjectionJobFactory we cannot inject properties from JobDataMap coming from triggers. I can see that job properties are empty at the moment of job execution
Version used
3.2.4
To Reproduce
Expected behavior
Fields filled with data mentioned in trigger JobDataMap
Additional context
According to my observations MergedJobDataMap contains the specified properties