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

23 lines
794 B
C#
Raw Normal View History

2023-01-09 15:36:58 +00:00
using Elsa.Elasticsearch.Scheduling;
using Elsa.Quartz.Jobs;
using Elsa.Scheduling.Jobs;
using Quartz;
using IJob = Elsa.Jobs.Services.IJob;
// ReSharper disable once CheckNamespace
namespace Elsa.Extensions;
public static class DependencyInjectionExtensions
{
public static IServiceCollectionQuartzConfigurator AddElsaJobs(this IServiceCollectionQuartzConfigurator quartz)
{
quartz.AddJob<RunWorkflowJob>();
quartz.AddJob<ResumeWorkflowJob>();
2023-01-10 13:29:27 +00:00
quartz.AddJob<ConfigureIndexRolloverJob>();
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));
}