Results 1 to 2 of 2

Thread: Auto Restart of failed job not working

  1. #1
    Join Date
    Apr 2012
    Posts
    2

    Default 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. #2
    Join Date
    Apr 2012
    Posts
    2

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •