首页 > 解决方案 > Quartz.net irregularly scheduled tasks

问题描述

I'll pull the times as a list from the database. It will give me the hours as [09:00,11:30,15.16,21.45,23:30]. I need to create a trigger during these hours. I don't know how many hours will come. I need to trigger how many times there are in the list. According to the code I've made now, I trigger it every 5 minutes. I couldn't find any examples of this on the internet. How can I solve this?

var scheduler = await StdSchedulerFactory.GetDefaultScheduler();
            if (!scheduler.IsStarted)
            {
                await scheduler.Start();
            }
            var job = JobBuilder.Create<QuartzTask>()
                .WithIdentity("ExecuteTaskServiceCallJob1", "group1")
                .Build();
            var trigger = TriggerBuilder.Create()
                .WithIdentity("ExecuteTaskServiceCallTrigger1", "group1").WithSimpleSchedule(x => x.WithIntervalInMinutes(15).RepeatForever()).StartNow().Build();

            await scheduler.ScheduleJob(job, trigger);

标签: asp.net-mvctaskscheduled-tasksquartz.netquartz

解决方案


推荐阅读