Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get details of all scheduled jobs and triggers in Quartz.NET c#

I have to create administration page of all scheduled jobs and triggers. How can i get details of running jobs and triggers in Quartz.NET? Can I pause/stop or update jobs? Is there any sample code?

like image 250
Brij Avatar asked Jul 15 '11 06:07

Brij


2 Answers

Here is how you would go about it using the StdSchedulerFactory

ISchedulerFactory schedFact = new StdSchedulerFactory();
foreach (IScheduler scheduler in schedFact.AllSchedulers)
{
    var scheduler1 = scheduler;
    foreach (var jobDetail in from jobGroupName in scheduler1.JobGroupNames
                              from jobName in scheduler1.GetJobNames(jobGroupName)
                              select scheduler1.GetJobDetail(jobName, jobGroupName))
    {
         //Get props about job from jobDetail
    }

    foreach (var triggerDetail in from triggerGroupName in scheduler1.TriggerGroupNames
                                  from triggerName in scheduler1.GetTriggerNames(triggerGroupName)
                                  select scheduler1.GetTrigger(triggerName, triggerGroupName))
    {
         //Get props about trigger from triggerDetail
    }
}
like image 119
Clayton Avatar answered Oct 04 '22 10:10

Clayton


Here an open project that does just this. The project should have all the code you need to create you own, or you can just use the open source project.

Web Based admin page for Quartz.net

  1. Allow registering of existing Quartz.net installations
  2. Allow viewing of Jobs and Triggers
  3. Allow scheduling of Jobs including editing JobDataMaps
  4. Allow viewing of calendars
  5. Allow viewing of trigger fire times
  6. Silverlight based timeline showing upcoming schedules
like image 39
Jethro Avatar answered Oct 04 '22 12:10

Jethro