Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Frameworks
Search Coderanch
Advance search
Google search
Register / Login
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
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Liutauras Vilda
Paul Clapham
Sheriffs:
paul wheaton
Tim Cooke
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Piet Souris
Bartenders:
Mike London
Forum:
Other Application Frameworks
Quartz Cron Expression Help
Kerry Wilson
Ranch Hand
Posts: 254
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I need my job to run every day at 6 AM. This expression is not working though I suspect that it is running on sundays.
<bean id="documentNotificationTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="documentNotificationJob" />
<!-- run at 6 in the morning -->
<property name="cronExpression" value="0 0 6 * * ?" />
</bean>
http://www.goodercode.com
SCJP 1.4
Christophe Verré
Sheriff
Posts: 14691
16
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
The expression looks fine. How are you using this trigger ?
[My Blog]
All roads lead to JavaRanch
Kerry Wilson
Ranch Hand
Posts: 254
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks for the reply, it did indeed run Sunday at 6 AM, here is the relevant spring configuration xml.
// DocumentNotificationJob.java public class DocumentNotificationJob extends QuartzJobBean { private ClientService clientService; private MailService mailService; private PartnerService partnerService; private SettingService settingService; protected void executeInternal( JobExecutionContext ctx ) throws JobExecutionException { // do notifications } <bean name="documentNotificationJob" class="org.springframework.scheduling.quartz.JobDetailBean"> <property name="group" value="notifications" /> <property name="name" value="document" /> <property name="jobClass" value="com.domain.scheduling.DocumentNotificationJob" /> <property name="jobDataAsMap"> <map> <entry key="clientService"><ref bean="clientService" /></entry> <entry key="mailService"><ref bean="mailService" /></entry> <entry key="partnerService"><ref bean="partnerService" /></entry> <entry key="settingService"><ref bean="settingService" /></entry> </map> </property> </bean> <bean id="documentNotificationTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail" ref="documentNotificationJob" /> <!-- run at 6 in the morning --> <property name="cronExpression" value="0 0 6 * * ?" /> </bean> <bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="documentNotificationTrigger" /> <!-- another job that is running --> <ref bean="databaseCleanupTrigger" /> </list> </property> </bean>
Thats some verbose stuff to get a cron to run, but I love the fact that I can tie it all in one neat package for deployment.
http://www.goodercode.com
SCJP 1.4
Christophe Verré
Sheriff
Posts: 14691
16
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Is the SchedulerFactoryBean always running in the background ?
[My Blog]
All roads lead to JavaRanch
Kerry Wilson
Ranch Hand
Posts: 254
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I guess so, it must setup all the scheduling when it is initialized.
http://www.goodercode.com
SCJP 1.4
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Spring + JDK time Scheduler + need help
Not creating managed bean
DataAccess using Spring...
Firing Quartz Job
org.springframework.batch.core.repository.JobExecutionAlreadyRunningException
More...