SpringBoot retry, remaining retries

Viewed 8320

I have used spring declarative retry in my project like

@Service
class Service {
  @Async  @Retryable(maxAttempts=12, backoff=@Backoff(delay=100, maxDelay=500))
    public service() {
        // ... do something
    }
}

Now, I have two questions.

  1. Is it fine to use retry with async, I don't have any issue, just want to be sure.

  2. The second requirement is, if the process fails I want to log it to log file including the number of remaining retries. So, is there a way to pass, or obtain the number of remaining retries from inside the method?

2 Answers
Related