Quartz. NET Quick Start Lesson 1 (Official Website document translation), quartz.net Quick Start

Source: Internet
Author: User

Quartz. NET Quick Start Lesson 1 (Official Website document translation), quartz.net Quick Start

Quartz. NET Quick Start Lesson 1 (Official Website document translation)

Original article link

Before you use sched, You need to instantiate it (who can guess this ?). When instantiating schedfactory, you need to use ISchedulerFactory.

 

After you instantiate scheduler. You can start, keep it in wait mode, and disable it. Note: Once scheduler is disabled, it cannot be restarted. Unless you create a new scheduler. If the schededtrigger is not started (Triggers) (the code in the Ijob instance object is not executed), the trigger remains in the waiting state.

 

 

 1     // construct a scheduler factory 2     ISchedulerFactory schedFact = new StdSchedulerFactory(); 3      4     // get a scheduler 5     IScheduler sched = schedFact.GetScheduler(); 6     sched.Start(); 7      8     // define the job and tie it to our HelloJob class 9    IJobDetail job = JobBuilder.Create<HelloJob>()10         .WithIdentity("myJob", "group1")11         .Build();12   13    // Trigger the job to run now, and then every 40 seconds14    ITrigger trigger = TriggerBuilder.Create()15       .WithIdentity("myTrigger", "group1")16       .StartNow()17       .WithSimpleSchedule(x => x18           .WithIntervalInSeconds(40)19           .RepeatForever())20       .Build();21       22   sched.ScheduleJob(job, trigger);

As shown in the code above, it is easy to make Quartz. NET work. In the next section, we will provide a quick preview of Jobs and Triggers, so that you can better understand the above Code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.