1

I am trying to implement the retry logic or mechanism on micro-services to micro-services call. Basically, have to attempt retry 2 times if server is down only.

I tried to use @Retryable and @Recover to perform same but no luck. Instead I can thought of to use try-catch to catch particular exception when server is down, but I am not aware which exception will work and I can use it in try-catch to attempt retry 2 times when server is down.

Moreover, I checked and hence found for such cases there is ResourceAccessException which basically made for when server is down but I am not sure.

Your help will be most appreciated. Please guide me here.

2 Answers2

1

Spring @Retryable should do the job

https://www.baeldung.com/spring-retry

NB: @EnableRetry is important

vladtkachuk
  • 656
  • 4
  • 13
0

You can implement a Circuit Breaker with Spring Boot. Circuit Breakers allow you to manage the error in the event of both a retry and an error.

Here are some Circuit Breakers that you can use with Spring Boot:

fatih
  • 1,285
  • 11
  • 27