• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Spring and Quartz integration

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's move this to the Application Framework forum, where the Spring-savvy folks hang out.
 
Marshal
Posts: 14507
240
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 633
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!