Using Spring.NET and Quartz.NET Job Scheduler
In this tutorial we are going to demonstrate how to scheddule repetitive jobs using spring.net and Quartz.
To follow this articles you have to install visual studio and reference spring.core and spring.scheduler.quartz libraries. We will use nuget package gallery to install libraries
1. Using nuget package gallery with visual studio 2012
1. Create a console project using visual studio
- Expand your project and Right click references
- Click Manage nuget Packages
- Click Online and Search for spring , localize spring.core and install it
- Click Online and Search for spring , localize spring.scheduling.quartz and install
Expand references and open packages.config folder to verify that libraries and dependencies are installed
2. Scheduling repeatitive jobs
Create a class MyJob.cs and put its content as follow
- Create a class and name it JobService. note that its A ‘plain’ object (no inheritance of any infrastructure base class) whose method will be invoked by Quartz.
3. Configuring Spring IoC
Add a spring-objects.xml file and put its content as follow
Update your programm class as folow to configure and run Job
Thats all Press F5 to run application
the result is we have two jobs :
one running every 20 second of minute and another running repeatedly every 5 seconds