Announcement Announcement Module
No announcement yet.
How could I using persistent jobs with ScheduleFactoryBean ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How could I using persistent jobs with ScheduleFactoryBean ?

    I want to achieve a transactional execution as a MethodInvokingJobDetailFactoryBean:
    <bean id="scheduledIndexingTask" class="org.springframework.scheduling.quartz.Metho dInvokingJobDetailFactoryBean">
    <property name="targetObject" ref="indexService"></property>
    <property name="targetMethod" value="buildIndex"></property>
    <property name="concurrent" value="false"></property>
    <bean class="org.springframework.scheduling.quartz.Sched ulerFactoryBean" lazy-init="false">
    <property name="transactionManager" ref="transactionManager"></property>
    <property name="triggers">
    <bean class="org.springframework.scheduling.quartz.CronT riggerBean">
    <property name="jobDetail" ref="scheduledIndexingTask"></property>
    <property name="cronExpression">
    <value>0 50 20 * * ?</value>
    The "indexService" bean is proxied by DefaultAdvisorAutoProxyCreator to be transactional. (there's a TransactionAttributeSourceAdvisor in my beans)

    The javadoc of SchedulerFactoryBean said the preferred way to achieve transactional execution is to demarcate declearative transactions at business facade level(which is just what i did).

    How can I define a transactionProxyFactoryBean for the Scheduler itself to avoid transactional proxied jobs by DefaultAdvisorAutoProxyCreator ? Thanks.

  • #2
    There were a few solutions in some threads but not very well:
    One of them suggested writing another class which implements ApplicationContextAware to complete my persistent job that was declearative in applicationContext.

    But I got another problem: my bean in service layer implements an interface, so it will be dynamic proxied by jdk1.4 which i use and I can't covert proxied bean as a member of org.quartz.Trigger[] property in SchedulerFactoryBean.

    Where is my key problem? How can I handle schduling persistent jobs ? Thanks.