0

I wanted to create two retry methods. Where in second retry method is async method. It should be hit only after successful completion of first method.

@Retryable(value = { LockedException.class }, maxAttempts = 3, backoff = @Backoff(delay = 1000))

Public String firstMethod() {    
    return "first";    
}

@Async
@Retryable(value = { LockedException.class }, maxAttempts = 3, backoff = @Backoff(delay = 1000))    
public String secondMethod() {    
    return "second";    
}

How would I do this?

lugiorgi
  • 473
  • 1
  • 4
  • 12
gowtham g
  • 43
  • 8
  • 1
    Call `firstMethod()` method before `secondMethod()`? – narendra-choudhary Feb 16 '20 at 16:08
  • What if first method fails and is in retry loop . I don't want second method to be executed in that case. Second mthod should only be executed only if successful completion of first method – gowtham g Feb 17 '20 at 06:08
  • What if you call `secondMethod` from `firstMethod`? You would have to move one of the two methods to a different bean though (because of async) – lugiorgi Feb 17 '20 at 11:30

0 Answers0