I have the current code for my Quartz scheduler:
var scheduler = StdSchedulerFactory.GetDefaultScheduler();
var Job1 = JobBuilder.Create<Test1>().WithIdentity("job1", "group1").Build();
var Job2 = JobBuilder.Create<Test2>().WithIdentity("job2", "group2").Build();
ITrigger trigger1 = TriggerBuilder.Create().WithIdentity("trigger1", "group1").StartNow().Build()
ITrigger trigger2 = TriggerBuilder.Create().WithIdentity("trigger2", "group2").StartNow().WithSimpleSchedule(x => x.WithIntervalInSeconds(1).WithRepeatCount(4)).Build();
JobKey jobKey1 = new JobKey("Job1", "group1");
JobKey jobKey2 = new JobKey("Job2", "group2");
JobChainingJobListener chain = new JobChainingJobListener("testChain");
chain.AddJobChainLink(jobKey1, jobKey2);
scheduler.ScheduleJob(Job1, trigger1);
scheduler.AddJob(Job2, true);
scheduler.ListenerManager.AddJobListener(chain, GroupMatcher<JobKey>.AnyGroup());`
scheduler.Start();
(To clarify the job, they do nothing but print on the console at the moment.)
On the Quartz website, I found that this would add a JobListener that is interested in all jobs: scheduler.ListenerManager.AddJobListener(chain, GroupMatcher<JobKey>.AnyGroup());I'm not sure if this is equivalent to a global listener.
I also found some code where people did scheduler.addGlobalJobListener(chain);in Java. Is there an equivalent method in C #?
My code compiles and seems to work without errors, but Job2 does not start. Job1 prints correctly on the console.
source
share