Uses of the Quartz Listeners
Armed with all this information, what can you do with these listeners? Actually, you can do quite a bit. First, it's worth noting that, internally, Quartz uses these listeners to help manage the Scheduler and your jobs and triggers. The framework also includes a couple plug-ins that implement the listener interfaces that log all job and trigger history: org.quartz.plugins.history.LoggingJobHistoryPlugin and org.quartz.plugins.history.LoggingTriggerHistoryPlugin, respectively. We talk about Quartz plug-ins in the next chapter.
Here are a few uses for listeners:
- Catching misfires and rescheduling
- Sending an e-mail after successful completion of a job
- Vetoing job execution based on certain flags set up in the database
- Scheduling other jobs based on successful or failed completion of a job
- Recording the actual time a job runs
These are only a few ideas. Quartz listeners provide a way for you to be notified programmatically when specific events take place during the runtime of your Quartz application. What you choose to do with that knowledge, if anything, is entirely up to you.