Introduction to TaskManager, open-source Task Management Platform
A long time ago, I was preparing to write the Quartz series of articles. Now I can achieve it. This article introduces you to a task management platform. Do you need an application to execute a task at work? This task may only be executed on the last day of each month at every day or Tuesday. If a serious error occurs during the execution of an automatic task without intervention, can the application know that the task fails to be executed and try to execute it again? Are you and your team using. NET programming? If any of these questions is answered, you should use the Quartz. NET scheduler.
Reading directory
- Introduction to Quart. Net
- Cron expression
- Implementation principle of open-source TaskManager
- Introduction
- Summary
Back to Z. NET at the top
Quartz. NET is an open-source job scheduling framework and is a. NET port of the Quartz API of OpenSymphony. It is written in C # and can be used in winform and asp.net applications. It provides great flexibility without sacrificing simplicity. You can use it to create simple or complex scheduling for executing a job. It has many features, such as database support, clusters, plug-ins, and cron-like expressions. : Quart. Net
For example, we need to implement an application for express delivery progress query. We certainly do not have the database of each express delivery manufacturer. We can only use the API interfaces provided by the manufacturer to obtain data. Fortunately, many existing interfaces are integrated with various vendors based on these foundations. Now the customer raised a request to send me an email or SMS reminder when the delivery order progress changes. I think many online shopping friends have this kind of demand. I bought a new item and checked the progress from time to time. I look forward to coming soon. This reminder feature becomes very urgent. I am also an open-source TaskManager project based on my own needs.
Return to the top Cron expression
The Cron expression is used to specify the task execution frequency. I have previously written an article about the Quartz Cron expression online generator. You can use it directly.
Go back to the top open-source TaskManager introduction and implementation principles
TaskManager is an open-source task management system based on Quartz. NET. It is carried by the Window service. Currently, the system integrates three common tasks: proxy IP crawler, express delivery progress, and Message notification.
Proxy IP Crawler: Crawls the latest proxy IP address information from the website every hour. The crawled data is in the p_IPProxy table. With these proxy IP addresses, they can be used as voting machines, applications such as click farming interfaces. I believe you must have encountered a problem when a classmate or colleague sent you a link asking you to vote for XX. However, many votes have limited one IP address to vote for only one vote, with many proxy IP addresses, you can vote for N votes by one person. The next article will introduce the instances that use the proxy IP request interface to obtain data.
Delivery progress:This is a good news for friends who are keen on online shopping. Of course it is also true for me. The biggest headache for online shopping friends is where my express delivery is. I open the client from time to check the delivery progress. If the delivery progress changes, I can send text messages or send email reminders, I don't have to worry about finding out where the courier is. Let's take a look at the email reminder. Are you very excited? I really want to use this open-source TaskManager platform!
Message notification:Message notification table p_Message (table of messages to be sent) and p_MessageHistory (table of messages that have been sent or failed to be sent)
At present, a message is inserted when there is a message change in the courier task, and the message notification task polls the p_Message table once every 3 minutes. Each message can be sent up to three times (the previous two failed ), after sending the message, insert the p_Message data to p_MessageHistory.
Project Structure:The project is a windows Service Based on Quartz. NET. It currently contains six projects
System Principle Analysis:
Development Mode:
To add a new task, follow these steps:
1. Add the Task class that inherits the IJob interface under the TaskSet folder of the Mysoft. Task project. You can refer to the existing IpProxyJob
2. Modify the TaskConfig. xml configuration file.
The most important part is the running frequency. How do I write CronExpressionString? This is also taken into consideration for everyone. You can use the online Cron generator to generate the address metadata.
Back to Top
This section describes the functions and implementation principles, and describes how to use TaskManager. Because the Windows Service is used as the bearer device, we only need to know how to install the Windows Service to use the platform. Here, many people do not know how to install and uninstall the Windows service, so we provide a small tool that I wrote earlier to install and uninstall the Windows service. The source code is also put in TaskManager.
1. Right-click to run the Windows Installation and uninstallation tool as an administrator
2.select taskmanger.exe-install-run
After running successfully, you can find the "scheduled task management service" in System Management-> services"
After running successfully, the Logs folder is generated to record the execution log
Of course, you need to configure the system. The following describes the configuration process. System Configuration File Path: Config \ Config. xml
1. database connection information
You can use SVN to download the code "SQL merge script _ 20150911. SQL" from the task system under the MyDocument project to create related tables and initial data.
Modify the SqlConnect node value for your own database connection
2. Insert the simulation data of the express order
Currently, You need to manually insert the express waybill number for the express task.
INSERT INTO dbo.p_ExpressInfo(ExpressNo,ExpressCompanyCode,Receiver)SELECT '880350384879600241' AS ExpressNo,'yuantong' AS ExpressCompanyCode,'youemial@xx.com' AS Receiver
The youemail@xx.com for receiving progress information change email address, as long as there is a progress change, the system will automatically send an email,Remember to change it to your email address.
ExpressNo: The Express bill number.
ExpressCompanyCode: Courier company Code. This value can be queried from the p_ExpressCompany table.
For more instructions, refer toInstructions for use .docxDocument
Back to Top Summary
The content to be introduced in this article is over. Let's look forward to it! I hope that some friends who like it can work together to improve TaskManager (fully open-source) and make it a tool that can improve the convenience of life and add many new tasks. For example, if it is raining or snowing the next day, send an email to remind you to bring your umbrella .... Now it's time to release the source code. Coming soon!
TaskManagerSVN address: The http://code.taobao.org/svn/TaskManagerPub/Branch uses the svn checkout command to download.
Experience tool: After TaskManager is decompressed, modify the Config. xml database connection and install it using WSWinForm.
If you believe that reading this blog has some benefits, click 【Recommendation] Button.
If you want to discover my new blog more easily, click 【Follow me].
Because my enthusiasm for writing is inseparable from your support.
Thank you for reading this article. If you are interested in the content of my blog, continue to follow up on my blog.