Quartz.net Quick Start First lesson (official website document translation)
Original link
before you use the dispatcher (Scheduler), you need to instantiate it (who can guess this?). )。 When instantiating scheduler, you need to use ischedulerfactory.
After you instantiate the good scheduler. You can start, leave it in wait mode, and turn it off. Please note: Once the scheduler is closed, it will no longer be restarted. Unless you're instantiating a new scheduler. If the scheduler is not started (Triggers) (the code in the Ijob instance object is not executed), the trigger remains in the wait state
1 //construct a scheduler factory2Ischedulerfactory schedfact =Newstdschedulerfactory ();3 4 //Get a scheduler5IScheduler sched =Schedfact.getscheduler ();6 Sched. Start ();7 8 //define the job and tie it to our Hellojob class9Ijobdetail job = jobbuilder.create()Ten. Withidentity ("MyJob","group1") One . Build (); A - //Trigger the job to run now, and then every seconds -Itrigger trigger =triggerbuilder.create () the. Withidentity ("Mytrigger","group1") - . Startnow () -. Withsimpleschedule (x =x -. Withintervalinseconds ( +) + . RepeatForever ()) - . Build (); + ASched. Schedulejob (Job, trigger);
As shown in the code above, let quartz.net work to be simple. In the next section, we'll give a quick preview of jobs and triggers, so you'll have a clearer understanding of the code above.
Quartz.net Quick Start First lesson (official website document translation)