This article is a mirror article of machine translation, please click here to jump to the original article.

View: 41993|Reply: 7

[Frame] Open source job scheduling framework Quartz

[Copy link]
Posted on 5/18/2019 4:51:41 PM | | | |
This post was last edited by Kongcicada on 2019-5-18 16:53

preface



As mentioned in the previous article, it is very convenient to use Topshelf with Quartz.Net to execute tasks regularly. This article will document how to use Quartz.Net.



tools

>VS 2017




Text

Quartz is an open source framework that is generally used in conjunction with timing services. Based on the previous Topshelf, the code only needs to be slightly modified.


1: Create a new console application.


2: Introduce Topshelf and Quartz dll (with Common.Logging.Core.dll )





3: Create two new classes with the names :ServiceRunner.cs and TestJob.cs


4: In ProgramMain function into the Topshelf code.





5: InServiceRunner.csInsert it in the middle


In the above code, what is implemented is how many seconds it triggers. It can also be triggered at a fixed time. For example: 6 o'clock every day. Every Monday at 10 o'clock, etc. See Quartz Cron expressions.

The writing method has also been modified accordingly




6: InTestJob.cs pasted in




7: F5 starts, and you can see that a line of data is output every three seconds.

8: After debugging, you can install the service according to the method in the previous article. You can also write a batch file directly, just run it. No need to knock on the command line

Installation Services:
Create a new notepad: Rename and change the suffix name :Install.bat
Right-click Notepad to open it and paste the following command to save.

Uninstall Services:
Create a new notepad: Rename and change the suffix name :Uninstall.bat
Right-click Notepad to open it and paste the following command to save.



Note:
  Once > is installed, the service is started before it runs.
  > install and uninstall services using administrator privileges.
  > modify the configuration file, you will need to restart the service for it to take effect.


Epilogue

  This article is only about code and simple use. Specific theoretical information can be referenced  The hyperlink login is visible.Official documentation.









Previous:Understanding of BIO and NIO
Next:Please tell me about the java operation rabbitmq, basicQos() is invalid
Posted on 5/18/2019 5:02:47 PM From the phone |
Great
Posted on 5/20/2019 9:30:40 AM |
How do I dynamically add or delete scheduled tasks?
Posted on 5/20/2019 9:37:17 AM |
Learn to learn
Posted on 5/20/2019 9:44:44 AM |
Great, I wrote a real-time monitoring service before, and this scheduled start service may be useful in the future
Posted on 5/21/2019 1:36:57 PM |
The empty cicada boss is awesome
 Landlord| Posted on 5/26/2019 1:18:04 PM |
Published on 2019-5-20 09:30
How do I dynamically add or delete scheduled tasks?

You can build a generic task class. Inherit the IJob interface. Just call the transmission reference.
Posted on 10/24/2021 6:03:21 PM |
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com