I am trying to implement the resilience4j retry into my application. I have already implemented circuit-breaker and it was imported just fine – however, I am unable to implement retries and I am not sure why that is.
build.gradle
implementation("io.github.resilience4j:resilience4j-spring-boot3:2.2.0")
implementation("io.github.resilience4j:resilience4j-circuitbreaker:2.2.0")
implementation("io.github.resilience4j:resilience4j-retry:2.2.0")
application.yml
# Circuit Breaker
resilience4j.circuitbreaker:
confgs:
default:
failureRateThreshold: 20
# Retry
resilience4j.retry:
configs:
default:
maxAttempts: 3
waitDuration: 100
instances:
myFun:
baseConfig: default
Now, in my application, I am trying to add the @Retry annotation to the function that makes an REST request, but I’m getting an error when I attempt to import the retry module.
import io.github.resilience4j.retry
I am not able to post images as my reputation is too low. However, when I attempt to import the above, I receive an unresolved reference error as if it cannot find the module.
I imported the dependency for the retry, set up the configuration, and attempted to import it into my application. I verified that I am using the correct R4J versions and have rebuilt my project several times but to no avail.
Connor E is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.