lee*_*n3o 8 quartz-scheduler quartz.net
我有一些在Schedule上运行的Quartz.Net作业
scheduler.ScheduleJob(
new JobDetailImpl("MarkAsSolutionReminderJob", typeof(MarkAsSolutionReminderJob)),
new CalendarIntervalTriggerImpl("MarkAsSolutionReminderJobTrigger", IntervalUnit.Hour, 6));
Run Code Online (Sandbox Code Playgroud)
我可以在需要时手动触发此作业运行吗?
所以它继续正常运行,但在一段特定的代码中,我可能只想将它运行一次或两次.但它不影响预定的工作?
Bhu*_*ake 11
我可以在需要时手动触发此作业运行吗?
是的,您可以在需要时触发此工作.
使用void TriggerJob(JobKey jobKey)方法如下:
scheduler.TriggerJob(new Jobkey("MarkAsSolutionReminderJob"));
Run Code Online (Sandbox Code Playgroud)
如果要在按需执行时将一些数据传递给作业,也可以通过使用void TriggerJob(JobKey jobKey, JobDataMap data);下面相同方法的另一个重载来执行此操作:
Dictionary<string, string> data = new Dictionary<string, string>();
//populate dictionary as per your needs
JobDataMap jobData = new JobDataMap(data);
scheduler.TriggerJob(new Jobkey("MarkAsSolutionReminderJob"),jobData);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5871 次 |
| 最近记录: |