如果作业引发异常,我已经搜索了有关如何在一定时间后重新触发作业的答案。我看不到任何简单的方法来做到这一点。
如果我这样设置触发器:
JobDetail job = new JobDetail("Download catalog", null, typeof(MyJob));
job .Durable = true;
Trigger trigger= TriggerUtils.MakeDailyTrigger(12, 0);
trigger.StartTimeUtc = DateTime.UtcNow;
trigger.Name = "trigger name";
scheduler.ScheduleJob(job , trigger);
MyJob 看起来像这样:
public class MyJob : IJob
{
public void Execute(JobExecutionContext context)
{
var service = new service();
try
{
service.Download();
}
catch (Exception)
{
throw;
}
}
}
如果 service.Download() 调用引发某种异常,如何在 15 分钟后触发重新触发/重新触发?