elsa-core/src/modules/Elsa.Quartz/Extensions/DependencyInjectionExtensions.cs

20 lines
671 B
C#
Raw Normal View History

using Elsa.Quartz.Jobs;
using Elsa.Scheduling.Jobs;
using Quartz;
using IJob = Elsa.Jobs.Services.IJob;
namespace Elsa.Quartz.Extensions;
public static class DependencyInjectionExtensions
{
public static IServiceCollectionQuartzConfigurator AddElsaJobs(this IServiceCollectionQuartzConfigurator quartz)
{
quartz.AddJob<RunWorkflowJob>();
quartz.AddJob<ResumeWorkflowJob>();
return quartz;
}
2022-03-07 21:56:16 +00:00
private static IServiceCollectionQuartzConfigurator AddJob<TJob>(this IServiceCollectionQuartzConfigurator quartz) where TJob : IJob =>
quartz.AddJob<QuartzJob<TJob>>(job => job.StoreDurably().WithIdentity(typeof(TJob).Name));
}