General Structure of Quartz.NET and How To Implement It
2013-10-07 14:51
183 查看
General Structure of Quartz.NET and How To Implement It
1. Simple job schedule structure
Simple job schedule graph_01
The demo structure about the graph above could be:
The most important snippets are in “Example.cs” file :
And “SimpleJob.cs” would like :
It will run while user delivery the “Run()” in “Example.cs”. And we would see she screen shot like this:
2. Remote job schedule structure
Remote job schedule graph_02
The Demo structure could dive into two parts, the one is the client and the other is the server. The demo structure should be:
The most important code snippets in “clientExample.cs” are:
Note: If you do not use DB to store the data of schedule you can comment out the content named “set db info”.
This line is used to set the instance name, it is costumed.
This part is used to set the thread info about the job. It should be set both client side and server side code.
If you plan to use DB as your persistent level to store the scheduler data the part above is very necessary, otherwise, you could get rid of it from your code.
The first line is to tell quartz that you are going to store your scheduler data into the DB through ADO.NET.
The second line of this part, tell the quartz that you would use the default method to store your schedule data into DB. Because ADO.NET is default method to store the data in Quartz.NET, so we use default as the property.
The third line tells the quartz that your table name prefix. E.g. If there is a table named QRTZTest_Hello”, through the ‘QRTZTest_’ prefix, quartz would find it while running.
The fourth line tells the connection string to access your DB where the scheduler data stored.
The last line tells quartz that the DB is MSSQL. Because now quartz supports many different DB, e.g. Oracle, MySQL, SQLite, MSSQL etc. so this property is important.
Note: All the properties above about DB, should be set in client demo and server demo when you use DB as the persistent level to store your schedule data.
These properties are used to set remote exporter. And in server, should set following properties for suite.
At last, all the jobs in server could be able to delivery by the method in client. Yes, you should start two instances when you debug it. Client instance first, and then the server instance.
And you can see the result in the server instance.
Note: You must add “TopShelf” namespace into the server code.
While if the DB has been used as persistent level. The scheduler data could be seen in the table like this:
Additionally, how to run the server as a service by “Topshelf”
1) Compile the server project.
2) Find the executable file produce by the first step
3) Then run cmd prompt as administrator and input the like this:
The executable file name could be replaced by any of yourselves.
4) At last you could find it has been installed in your Services:
1. Simple job schedule structure
Simple job schedule graph_01
The demo structure about the graph above could be:
The most important snippets are in “Example.cs” file :
And “SimpleJob.cs” would like :
It will run while user delivery the “Run()” in “Example.cs”. And we would see she screen shot like this:
2. Remote job schedule structure
Remote job schedule graph_02
The Demo structure could dive into two parts, the one is the client and the other is the server. The demo structure should be:
The most important code snippets in “clientExample.cs” are:
Note: If you do not use DB to store the data of schedule you can comment out the content named “set db info”.
This line is used to set the instance name, it is costumed.
This part is used to set the thread info about the job. It should be set both client side and server side code.
If you plan to use DB as your persistent level to store the scheduler data the part above is very necessary, otherwise, you could get rid of it from your code.
The first line is to tell quartz that you are going to store your scheduler data into the DB through ADO.NET.
The second line of this part, tell the quartz that you would use the default method to store your schedule data into DB. Because ADO.NET is default method to store the data in Quartz.NET, so we use default as the property.
The third line tells the quartz that your table name prefix. E.g. If there is a table named QRTZTest_Hello”, through the ‘QRTZTest_’ prefix, quartz would find it while running.
The fourth line tells the connection string to access your DB where the scheduler data stored.
The last line tells quartz that the DB is MSSQL. Because now quartz supports many different DB, e.g. Oracle, MySQL, SQLite, MSSQL etc. so this property is important.
Note: All the properties above about DB, should be set in client demo and server demo when you use DB as the persistent level to store your schedule data.
These properties are used to set remote exporter. And in server, should set following properties for suite.
At last, all the jobs in server could be able to delivery by the method in client. Yes, you should start two instances when you debug it. Client instance first, and then the server instance.
And you can see the result in the server instance.
Note: You must add “TopShelf” namespace into the server code.
While if the DB has been used as persistent level. The scheduler data could be seen in the table like this:
Additionally, how to run the server as a service by “Topshelf”
1) Compile the server project.
2) Find the executable file produce by the first step
3) Then run cmd prompt as administrator and input the like this:
The executable file name could be replaced by any of yourselves.
4) At last you could find it has been installed in your Services:
相关文章推荐
- General Structure of Quartz.NET and How To Implement It
- iOS开发UI-Quartz2D what about Quartz2D ?and how to use it ?
- How to find PID of process listening on a port in Linux? netstat and lsof command examples
- EOF的定义与有效使用(Definition of EOF and how to use it effectively )
- Why do we need smart pointer and how to implement it.
- How to implement HTML file into GAE project and solution of bindError
- CodeSnip: How to Get Id of the Record Using ASP.NET and SQL Server 2000
- How to define a template class in a .h file and implement it in a .cpp file
- How to structure a Zend Framework application and its dependencies
- (Page 1 of 3 )A walking tour of JavaBeans What JavaBeans is, how it works, and why you want to use it
- Why to use memory pool and how to implement it
- (Page 2 of 3 )A walking tour of JavaBeans 2 :What JavaBeans is, how it works, and why you want to use it
- (Page 3 of 3 )A walking tour of JavaBeans What JavaBeans is, how it works, and why you want to use it
- About:How to write the declaration of pointers and references rightly.
- How to use outline levels to create a table of contents (TOC) in Word 2003 and in Word 2002
- How to implement an ArrayList structure in Java - Tutorial
- G. Polya and “How to Solve It!”
- How to SUM and GROUP BY of JSON data?
- Why we made vorlon.js and how to use it to debug your JavaScript remotely
- 15 Minute SEO List - Learn how to SEO:List of Best and Worst practices for designing a high traffic website