public QuartzHostedService( ISchedulerFactory schedulerFactory, SchedulerHealthCheck healthCheck) { this.schedulerFactory = schedulerFactory; this.healthCheck = healthCheck; }
public QuartzHostedService( ISchedulerFactory schedulerFactory, SchedulerHealthCheck healthCheck, QuartzHostedServiceOptions options) { this.schedulerFactory = schedulerFactory; this.healthCheck = healthCheck; this.options = options; }
public static IServiceCollection AddQuartzServer( this IServiceCollection services) { return(services.AddSingleton <IHostedService>(serviceProvider => { var check = new SchedulerHealthCheck(); services.AddSingleton(check); services .AddHealthChecks() .AddQuartzHealthCheck("scheduler", check); var scheduler = serviceProvider.GetRequiredService <ISchedulerFactory>(); return new QuartzHostedService(scheduler, check); })); }
public static IServiceCollection AddQuartzServer( this IServiceCollection services, Action <QuartzHostedServiceOptions>?configure = null) { return(services.AddSingleton <IHostedService>(serviceProvider => { var check = new SchedulerHealthCheck(); services.AddSingleton(check); services .AddHealthChecks() .AddQuartzHealthCheck("scheduler", check); var scheduler = serviceProvider.GetRequiredService <ISchedulerFactory>(); var options = new QuartzHostedServiceOptions(); configure?.Invoke(options); return new QuartzHostedService(scheduler, check, options); })); }