Étiquettes

, , , , ,

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

1

  • Click Online and Search for spring , localize spring.core and install it
  • Click Online and Search for spring , localize spring.scheduling.quartz and install

23

Expand references and open packages.config folder to verify that libraries and dependencies are installed4

2. Scheduling repeatitive jobs

Create a class MyJob.cs and put its content as follow

5

  • 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.

6

3. Configuring Spring IoC

Add a spring-objects.xml file and put its content as follow

7 8

Update your programm class as folow to configure and run Job

9

Thats all Press F5 to run application

10

the result is we have two jobs :

one running  every 20 second of minute  and another running repeatedly every 5 seconds