I have some Quartz.Net jobs which are running on a Schedule
scheduler.ScheduleJob(
new JobDetailImpl("MarkAsSolutionReminderJob", typeof(MarkAsSolutionReminderJob)),
new CalendarIntervalTriggerImpl("MarkAsSolutionReminderJobTrigger", IntervalUnit.Hour, 6));
Is it possible for me to manually trigger this Job to run when I want it to?
So it continues to run as normal, but in a specific piece of code I might want to just run it out of schedule once or twice. But it doesn't affect the scheduled job?
Best Answer
Yes, you can trigger this job as and when you need.
Use
void TriggerJob(JobKey jobKey)
method for this as below:If you want to pass some data to the job while executing it on demand, you can also do that by just using another overload
void TriggerJob(JobKey jobKey, JobDataMap data);
of the same method as below: