Page 1 of 2
It's time to learn new Quartz 2 API
using JBoss AS 7
. This tutorial shows how to install it on JBoss AS 7 and how to configure some simple Jobs of it. In the second part of it, we will show how to add an advanced configuration which includes a JDBC Job Store.
(In this tutorial we will use Quartz 2.0.2 although a Quartz 2.1 release has been just published.)
In the earlier versions of JBoss AS 7 Quartz was bundled along with the application server, now we will set up by ourselves: however don't worry it will take just a minute.
Installing quartz module on JBoss AS 7
Create the following module structure under JBOSS_HOME/modules
And here's module.xml file:
As you can see the module contains 2 dependencies, although javax.api dependency will be just needed if you want to store your jos through a Datasource JDBC connection.Ok, now let's create a sample web application with a basic Quartz servlet in it:
And here's the simple HelloJob class:
The most evident for you at the moment are Quartz static initializers. Quartz 2.0 API provides a new builder-based API based on a Domain Specific Language (DSL) for constructing job and trigger definitions. Usage of static imports makes your code nice and clean when using the new DSL.
Here's for example how you used to create a JobDetail in older quartz Api:
and here's the Quartz 2.0 version: