Quartz. Net Study Notes (1)-complete example, quartz.net Study Notes

Source: Internet
Author: User

Quartz. Net Study Notes (1)-complete example, quartz.net Study Notes
I. Development Environment

System: Win10

Compiler: VS2013

. Net: 4.5

Quartz version: 2.3.3

Ii. Assembly

Common. Logging. Core. dll

Common. Logging. dll

Quartz. dll

Iii. Project Structure

Namespace QuartzNet. jobs {public class JobGetNowTime: IJob {public void Execute (IJobExecutionContext context) {Console. writeLine (DateTime. now. toString ("yyy-MM-dd hh: mm: ss "));}}}3. Start using the scheduling framework

Namespace QuartzNet {class Program {/// <summary> // the function of the following Program is to output the current time per second, execute 10 times /// </summary> /// <param name = "args"> </param> static void Main (string [] args) {// 1.0 create the scheduling factory ISchedulerFactory factory = new StdSchedulerFactory (); // 2.0 obtain the scheduler instance IScheduler scheduler = factory through the factory. getScheduler (); // 3.0 construct Job IJobDetail job = JobBuilder through JobBuilder. create <JobGetNowTime> (). build (); // 4.0 TriggerBuilder to Build Trigger ISimpleTrigger trigger = (ISimpleTrigger) TriggerBuilder. create (). withSimpleSchedule (a =>. withIntervalInSeconds (1 ). withRepeatCount (10 )). build (); // 5.0 assemble each component <Job, Trigger> scheduler. scheduleJob (job, trigger); // 6.0 start scheduler. start (); Thread. sleep (10000); // 7.0 destroy the built-in Job and Trigger scheduler. shutdown (true); Console. readKey ();}}}
4. view results

V. References

Http://blog.csdn.net/chenweitang123/article/details/37777399

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.