Using the ABP background job config settings during preinit to use hangfire is fine, there's a minor annoyance at restart however where jobs that were in the queue will fail until the IoC container registration in initialize. Is there a good way to prevent the hangfire server from processing until then?
3 Answer(s)
-
0
Hi @rmorris, base on my understanding, background job is resume in module PostInitialize()
public override void PostInitialize() { // more code if (Configuration.BackgroundJobs.IsJobExecutionEnabled) { var workerManager = IocManager.Resolve<IBackgroundWorkerManager>(); workerManager.Start(); workerManager.Add(IocManager.Resolve<IBackgroundJobManager>()); } }
See <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/AbpKernelModule.cs#L91">https://github.com/aspnetboilerplate/as ... ule.cs#L91</a>
IoC container registration in initialize
Can you explain more on this?
-
0
@ryancyq, the jobs were failing due to my job's service being injected with a NullObjectMapper so I was just assuming that was the case, however looks like my worker module is calling the RegisterAssemblyByConvention method off the IocManager before the jobs start failing.
-
0
I see. Is your ObjectMapper property injected?