To trigger the a specific quartz job to run at start-up in Spring-Quartz environment, you must create two triggers.
1. The trigger that will run on schedule.
<bean id="someJobCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="someJob" />
<property name="cronExpression" value="0 0 0,6,12,18 ? * *" />
</bean>
2. Trigger that will only run 10 seconds after start-up with zero repeat.
<bean id="someJobStartUpTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="someJob" />
<property name="startDelay" value="10000" />
<!-- repeat every 50 seconds -->
<property name="repeatInterval" value="50000" />
<property name="repeatCount" value="0" />
</bean>
No comments:
Post a Comment