0

Method annotated with @Retryable not getting invoked when called from batch process method.

@Service
public class HierarchyRetryOperationImpl implements HierarchyRetryOperation {

    private final HierarchyService hierarchyService;

    @Inject
    public HierarchyRetryOperationImpl(
            HierarchyService hierarchyService){
        this.hierarchyService= hierarchyService;
    }

    @Recover
    public HierarchyNode reportFailureReadHierarchyForBatch(SystemException cause) {
        return null;
    }


    @Override
    @Retryable(value = SystemException.class , maxAttempts = 4,backoff = @Backoff(delay = 5000))
    public HierarchyNode readHierarchy() {
        return hierarchyService.readHierarchy( );
    }
}
M. Deinum
  • 115,695
  • 22
  • 220
  • 224
  • If it isn't called you aren't calling it. – M. Deinum Jul 22 '20 at 10:03
  • Where is this service used in your batch job and when are you expecting it to be retried? – Mahmoud Ben Hassine Jul 22 '20 at 10:54
  • I have used it in batch process method '@Override public ResultHolder process(String string) { ResultHolder resultHolder = new ResultHolder(); HierarchyNode root = hierarchyRetryOperation.readHierarchy(); } catch (RuntimeException e) { throw new SkippableException(e); } } return resultHolder; }' '@Configuration @EnableRetry public class SpringRetryConfig { }' Exp: org.springframework.retry.TerminatedRetryException: Retry terminated abnormally by interceptor before first attempt – vyman gowda Jul 23 '20 at 04:57
  • @MahmoudBenHassine Can u please help me out i have placed the code in the comment section above, stating from where the method is invoked. – vyman gowda Jul 27 '20 at 06:46

0 Answers0