I've been running the examples that come with Quartz.Net and I noticed that the scheduler still runs jobs even if the Windows service is stopped! So what is it there for?
Also, I ran this code in a unit test...
ISchedulerFactory schedFact = new StdSchedulerFactory();
// get a scheduler
IScheduler sched = schedFact.GetScheduler();
sched.Start();
// construct job info
JobDetail jobDetail = new JobDetail("myJob", null, typeof (MyJob));
Trigger trigger = TriggerUtils.MakeMinutelyTrigger(1);
trigger.StartTimeUtc = DateTime.UtcNow;
trigger.Name = "myTrigger";
sched.ScheduleJob(jobDetail, trigger);
The test completed but a breakpoint in the job didn't ever fire. What process do I need to attach to in order to debug a job?
What am I missing here? Is the StdSchedulerFactory not connected to the Windows Service?
Cheers, Ian.
EDIT:
Here is the code...
NameValueCollection properties = new NameValueCollection();
properties["quartz.scheduler.instanceName"] = "RemoteClient";
// set thread pool info
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.threadPool.threadCount"] = "5";
properties["quartz.threadPool.threadPriority"] = "Normal";
// set remoting expoter
properties["quartz.scheduler.proxy"] = "true";
properties["quartz.scheduler.proxy.address"] = "tcp://localhost:555/QuartzScheduler";
// First we must get a reference to a scheduler
ISchedulerFactory sf = new StdSchedulerFactory(properties);
IScheduler sched = sf.GetScheduler();
//sched.Start();
// define the job and ask it to run
JobDetail job = new JobDetail("remotelyAddedJob", "default", typeof(SimpleJob));
JobDataMap map = new JobDataMap();
map.Put("msg", "Your remotely added job has executed!");
job.JobDataMap = map;
CronTrigger trigger = new CronTrigger("remotelyAddedTrigger", "default", "remotelyAddedJob", "default", DateTime.UtcNow, null, "/5 * * ? * *");
// schedule the job
sched.ScheduleJob(job, trigger);
'SimpleJob' is just an implementation of IJob that's defined in the same assembly as the above code. And yes, it can't find the dll that the job type is defined in.