Quartz to Jenkins

At FreeCharge, initially, we were using quartz to run all our background jobs. These jobs were configured to run at some frequency, for example, say every 15 minutes.

Problems that we faced with this setup:

  •  No GUI to see what job is currently executing, when is the next run of this job scheduled.
  •  Say I want to see the logs for the job foo that ran yesterday at 8:30 in the night, quartz did not provide this out of the box.
  •  How do I monitor whether the jobs are running fine?
  •  No way to cancel a currently running job.
  •  Say I want to fire a job right now but it’s scheduled run is 15 minutes later, how do I do this?
  •  If there is an error while running a job, how do I get to know of this?
  •  Say for sometime I do not want a job to run, how do I achieve this?
  •  If a job is stuck for sometime, how do I time it out and re run it?

Most of you might know jenkins as a build/continuous integration server, but it solves all of the problems listed above.

We used to run our quartz jobs through spring quartz integration. As the first step, we removed this and created a main method for each job. Each of these main methods were configured as new jobs in jenkins. We rigged up our jenkins in such a way that as soon as the build is done, these jobs are triggered. Once triggered, these jobs call themselves at a pre determined interval.

With this configuration, we get a lot of things out of the box:

  • Nice GUI to monitor and see which jobs are currently running, which jobs are scheduled to run later, health of each run.
  • Through the GUI, we can run a job out of line, suspend a job for sometime and re enable it or completely nuke a job.
  • We can configure a job to time out if stuck and re trigger.
  • We get  a complete history(configurable) of  each job’s run along with the status of that run as well as the logs for that run.

If you too are interested in doing geeky things like this, let us know at devgigs@freecharge.com. We are always looking for curious people who want to build beautiful products.

5 thoughts on “Quartz to Jenkins

  1. So does this mean, you are not using Jenkins as your CI? Don’t tell me you are using old ways to setup your build!

  2. Hi ABHIRAMABHAT,

    Nice Approach. So did you got rid of Quartz completely. And are you loading the Spring Context separately before making calls to the main method of Jobs?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s