quartz.net - SchedulerException with Simple Job -
i'm trying started quartz.net 2.0. simple appearing test application failing schedulerexception
trigger's related job's name cannot null
the code adapted version 2.0 migration guide
ischedulerfactory schedfact = new stdschedulerfactory(); ischeduler classsched = schedfact.getscheduler(); classsched.start(); ijobdetail job = jobbuilder.create<classificationjob>() .withidentity("myjob", "my group") .withdescription("my description") .build(); timezoneinfo tzutc = timezoneinfo.utc; datetime starttime; starttime = datetime.utcnow; itrigger trigger = triggerbuilder.create() .withidentity("mytrigger", "my group") .withdescription("my description") .startat(starttime) .withsimpleschedule(x => x.withintervalinseconds(10).repeatforever()) .build(); classsched.schedulejob(trigger); // exception on line
why failing?
i think there 2 issues.
firstly, (despite example in migration guide), think need job trigger related to, ie call .forjob method , example
itrigger trigger = triggerbuilder.create() .withidentity("mytrigger", "my group") .withdescription("my description") .startat(starttime) .withsimpleschedule(x => x.withintervalinseconds(10).repeatforever()) .forjob(job) .build();
secondly, syntax using schedule job works if job has been added (eg if have called classsched.addjob(job,true); // or classsched.addjob(job,false);
if hasn't been done, need use syntax
classsched.schedulejob(job, trigger);
Comments
Post a Comment