Esempio n. 1
0
 public QuartzHostedService(
     ISchedulerFactory schedulerFactory,
     SchedulerHealthCheck healthCheck)
 {
     this.schedulerFactory = schedulerFactory;
     this.healthCheck      = healthCheck;
 }
Esempio n. 2
0
 public QuartzHostedService(
     ISchedulerFactory schedulerFactory,
     SchedulerHealthCheck healthCheck,
     QuartzHostedServiceOptions options)
 {
     this.schedulerFactory = schedulerFactory;
     this.healthCheck      = healthCheck;
     this.options          = options;
 }
Esempio n. 3
0
        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);
            }));
        }
Esempio n. 4
0
        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);
            }));
        }