Announcement Announcement Module
Collapse
No announcement yet.
Auto Restart of failed job not working Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Auto Restart of failed job not working

    Dears

    I am trying to retry a job in case an exception is raised during the execution of the job. But for some reason, the job is not restarted automatically. Her is the configuration I am using :

    job id="trialJob" xmlns="http://www.springframework.org/schema/batch"
    incrementer="jobParametersIncrementer">
    <step id="step1">
    <tasklet ref="trialStep" />
    </step>
    </job>

    <bean id="trialStep"
    class="com.xxx.tasklet.TrialJobTasklet"/>

    <aop:config>
    <aopointcut id="transactional"
    expression="execution(* com.xxx.tasklet.*.*execute(..))" />
    <aop:advisor pointcut-ref="transactional" advice-ref="retryAdvice"
    order="-1" />
    </aop:config>

    <bean id="retryAdvice"
    class="org.springframework.batch.retry.interceptor .RetryOperationsInterceptor">
    <property name="retryOperations">
    <bean class="org.springframework.batch.retry.support.Ret ryTemplate">
    <property name="retryPolicy">
    <bean class="org.springframework.batch.retry.policy.Simp leRetryPolicy">
    <property name="maxAttempts" value="4" />

    <property name ="retryableExceptions">
    <map>
    <entry key="java.lang.Exception" value="true" />
    </map>
    </property>

    </bean>
    </property>
    </bean>
    </property>
    </bean>
    My understanding is that with the above aop configuration, if there is an exception in the execute() method of any class in package com.xxx.tasklet, the job must be restarted automatically from where it stopped but it doesnt happen so.

    Can some one please advice what I am missing here ?

    Thanks in advance

  • #2
    Any suggestions on this please? I need this very urgent.
    The problem is that there is no error shown but the retry logic simple doesnt execute.

    Comment

    Working...
    X