Setting the trigger to call in 5 minutes after the start, and then every day at 10:00

633 Views Asked by At

Hello It is necessary for the rules to interrogate web server.

Regulation is that every day at 10:00 and 1 time after 5 minutes immediately after the start of the program.

Configure the call trigger at 10:00 I was able to

  ITrigger trigger = TriggerBuilder.Create()
        .WithIdentity("trigger3", "group1")
        .WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(10, 00))
        .ForJob(job)
        .Build();

But how to add 1 drawdown once after 5 minutes after the start?

 scheduler.ScheduleJob(job, trigger); 
1

There are 1 best solutions below

1
Johnny On

You can add one more simple trigger. Schedule that one at the specific moment with no repetition. There you are with the example. More information you can find at quartz.net.

// trigger builder creates simple trigger by default, actually an ITrigger is returned 
ISimpleTrigger trigger = (ISimpleTrigger) TriggerBuilder
.Create()
.WithIdentity("trigger1", "group1")
.StartAt(myStartTime) // some Date
.ForJob("job1", "group1") // identify job with name, group strings
.Build();