*
The moose likes Other Application Frameworks and the fly likes Spring and Quartz integration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Spring and Quartz integration" Watch "Spring and Quartz integration" New topic
Author

Spring and Quartz integration

Chris Bojinca
Greenhorn

Joined: Oct 14, 2002
Posts: 13
Hi,

I want to use the Scheduler component of Spring (in particular the Quartz scheduler), I configured the class that extends QuartzJobBean and the CronTriggerBean and also the XML Spring config file but I don't know what to run in order to start the scheduler.
Any help?

Thank you.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41137
    
  45
Let's move this to the Application Framework forum, where the Spring-savvy folks hang out.


Ping & DNS - my free Android networking tools app
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4446
    
    5

You would need to configure a SchedulerFactoryBean, specifying the list of triggers that would be created by the factory, then create an ApplicationContext. When the ApplicationContext is created, the Quartz scheduler will be created and started.


Junilu - [How to Ask Questions] [How to Answer Questions]
Jignesh Patel
Ranch Hand

Joined: Nov 03, 2001
Posts: 626

As far as only quartz concern,
This three line of code you have to implement
String configFile = getServletContext().getRealPath("\\WEB-INF\\ddc-quartz.properties");//cfg.getInitParameter("config-file");
SchedulerFactory sf = new StdSchedulerFactory(configFile);
scheduler = sf.getScheduler();
JobDetail jobDetail = new JobDetail("QuARTZJOB",Scheduler.DEFAULT_GROUP,QuartZJob.class);
CronTrigger trigger = new CronTrigger("QUARTZJOBTrigger","QUARTZCollectionTriggerGroup");
trigger.setCronExpression(cfg.getInitParameter("cronExpr"));
scheduler.scheduleJob(jobDetail, trigger);


the above code you need to write in the servlet init method. The deploy the servlet when application starts. Mention your trigger in config parameter.

I have not worked with Spring, but I believe Quartz is indepened application. You just need to deploy the quartz servlet and mention triggers.
 
 
subject: Spring and Quartz integration
 
Similar Threads
Quartz Scheduler in struts
Creating/calling thread within an Action
Automation
Java Scheduler - help in designing
Timer in java