Using CronTriggers in the JobInitializationPlugin

Table of contents:

Although plug-ins are not discussed until Chapter 8, "Using Quartz Plug-Ins," it's worth jumping ahead to show how CronTriggers can be used within the quartz_jobs.xml file to specify job information. The JobInitializationPlugin can be used to load job information from an XML file.

Just as with SimpleTriggers, you can specify CronTrigger expressions in the XML file, and the Quartz Scheduler will use this information to schedule your jobs. This is extremely convenient if you want to declare your job information externally to your application code. Listing 5.3 shows the quartz_jobs.xml file that is used with the JobInitializationPlugin to load job information.

Listing 5.3. CronTriggers Can Be Specified in an XML File and Loaded with the JobInitializationPlugin




 
 
 PrintInfoJob
 DEFAULT
 
 A job that prints out some basic information.
 
 
 org.cavaness.quartzbook.common.PrintInfoJob
 
 

 
 
 printJobInfoTrigger
 DEFAULT
 PrintInfoJob
 DEFAULT

 
 0 30 7 ? * MON-FRI
 
 
 

The cron expression shown in Listing 5.3 is the same one from Listing 5.1. When Quartz loads the XML file, it will schedule the PrintInfoJob (also listed in the XML file) to execute at 7:30 AM Monday through Friday. More is said about the JobInitializationPlugin in Chapter 8.


Cron Expressions Cookbook

Scheduling in the Enterprise

Getting Started with Quartz

Hello, Quartz

Scheduling Jobs

Cron Triggers and More

JobStores and Persistence

Implementing Quartz Listeners

Using Quartz Plug-Ins

Using Quartz Remotely

Using Quartz with J2EE

Clustering Quartz

Quartz Cookbook

Quartz and Web Applications

Using Quartz with Workflow

Appendix A. Quartz Configuration Reference



Quartz Job Scheduling Framework(c) Building Open Source Enterprise Applications
Quartz Job Scheduling Framework: Building Open Source Enterprise Applications
ISBN: 0131886703
EAN: 2147483647
Year: N/A
Pages: 148

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net