Esempio n. 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            //services.AddControllers();

            services.AddLogging(l => l.AddMyLabConsole());
            services.AddSingleton <ITaskKickerService, TaskKickerService>();

            var jobsConfig = JobOptionsConfig.Load("jobs.yml");

            services.AddKickerLogic(jobsConfig);
        }
        public static void AddKickerLogic(this IServiceCollection services, JobOptionsConfig jobsConfig)
        {
            services.AddHttpClient();

            services.AddQuartz(q =>
            {
                q.UseMicrosoftDependencyInjectionJobFactory();

                if (jobsConfig.Jobs != null)
                {
                    foreach (var jobOptions in jobsConfig.Jobs)
                    {
                        RegisterTaskKickJob(q, jobOptions);
                    }
                }
            });

            services.AddQuartzHostedService();
        }
Esempio n. 3
0
 public void CopyTo(JobOptionsConfig target)
 {
     target.Jobs = Jobs;
 }