Child pages
  • How can we schedule Quartz jobs

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3


The following code schedules an e-mail action:

Code Block
titleScheduling an Email Alertjava
Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();

JobDetail jobDetail = new JobDetail("email.send",
                                     scheduler.DEFAULT_GROUP, WebWorkJob.class);

Map m = jobDetail.getJobDataMap();
m.put("to", "");
m.put("subject", "quartz test");
m.put("body", "This is a quartz test, Hey ho");
m.put("smtpServer", "");
m.put("from", "");

SimpleTrigger trigger = new SimpleTrigger("myTrigger",
                                          new Date(), null, 0, 0L);

scheduler.deleteJob("email.send", scheduler.DEFAULT_GROUP);
scheduler.scheduleJob(jobDetail, trigger);