【发布时间】:2021-03-24 11:53:38
【问题描述】:
我知道我可以在构建触发器时指定 .WithMisfireHandlingInstructionDoNothing(),但我的一些作业是通过 IScheduler.TriggerJob() 方法触发的,因此没有任何触发器.
我可以在 ITriggerListener 侦听器中检测并记录失火,但如何阻止 Quartz 再次尝试启动该作业?如果我理解正确 .VetoJobExecution 不可用,因为无论如何都必须成功触发作业。
还有其他想法吗?
编辑:我的实现
JobDataMap jobData = new JobDataMap(data);
IJobDetail jobTemplate = await jobScheduler.GetJobDetail(jobKey);
var jobTrigger = TriggerBuilder.Create()
.ForJob(jobTemplate)
.UsingJobData(jobData)
.WithSimpleSchedule(s => s.WithRepeatCount(0).WithMisfireHandlingInstructionNextWithRemainingCount())
.StartNow()
.Build();
await jobScheduler.ScheduleJob(jobTrigger);
【问题讨论】:
标签: quartz.net misfire-instruction