vkarai
Nov 2nd, 2006, 11:58 AM
I'm a new Spring user so please forgive my ignorance if what I ask may be trivial or basic. In my applicationContext.xml, I would like to define one job and associate multiple triggers with that job. The motivation behind this is to define custom attributes for triggers and at the same time using common metadata defined at the job level. The following syntax is more than likely incorrect, but really illustrates what I need.
<bean name="hfsIndexJob" class="org.springframework.scheduling.quartz.JobDetailBea n">
<property name="jobClass" value="com.haydrian.mgmt.struts.util.HfsIndexingJob"/>
<property name="jobDataAsMap">
<map>
<entry key="timeToLive" value="3600000"/>
</map>
</property>
</bean>
<bean id="cronTriggerHfsIndex" class="org.springframework.scheduling.quartz.CronTriggerB ean">
<property name="jobDetail" ref="hfsIndexJob"/>
<!-- run every night at 9:15 PM -->
<property name="cronExpression" value="0 15 21 * * ?"/>
<!-- I want to be able to extend the JobDataMap so that the trigger sees these additional properties. I don't think this is the correct syntax though -->
<property name="jobDataAsMap">
<map>
<entry key="dailyIndexingScript" value="/svt/apps/hfs/daily_reindex.sh"/>
<entry key="weeklyIndexingScript" value="/svt/apps/hfs/weekly_reindex.sh"/>
<entry key="dayOfWeekToRunWeeklyJob" value="7"/>
</map>
</property>
</bean>
<bean name="hfsIndexJob" class="org.springframework.scheduling.quartz.JobDetailBea n">
<property name="jobClass" value="com.haydrian.mgmt.struts.util.HfsIndexingJob"/>
<property name="jobDataAsMap">
<map>
<entry key="timeToLive" value="3600000"/>
</map>
</property>
</bean>
<bean id="cronTriggerHfsIndex" class="org.springframework.scheduling.quartz.CronTriggerB ean">
<property name="jobDetail" ref="hfsIndexJob"/>
<!-- run every night at 9:15 PM -->
<property name="cronExpression" value="0 15 21 * * ?"/>
<!-- I want to be able to extend the JobDataMap so that the trigger sees these additional properties. I don't think this is the correct syntax though -->
<property name="jobDataAsMap">
<map>
<entry key="dailyIndexingScript" value="/svt/apps/hfs/daily_reindex.sh"/>
<entry key="weeklyIndexingScript" value="/svt/apps/hfs/weekly_reindex.sh"/>
<entry key="dayOfWeekToRunWeeklyJob" value="7"/>
</map>
</property>
</bean>