Questions tagged [resilience4j]

Resilience4j is lightweight alternative to Netflix Hystrix.

Resilience4j is a lightweight, easy-to-use fault tolerance library inspired by Netflix Hystrix, but designed for Java 8 and functional programming. Lightweight, because the library only uses Vavr (formerly Javaslang), which does not have any other external library dependencies. Netflix Hystrix, in contrast, has a compile dependency to Archaius which has many more external library dependencies such as Guava and Apache Commons Configuration. With Resilience4j you don’t have to go all-in, you can pick what you need.

Resilience provides several core modules and add-on modules:

Core modules:

resilience4j-circuitbreaker: Circuit breaking

resilience4j-ratelimiter: Rate limiting

resilience4j-bulkhead: Bulkheading

resilience4j-retry: Automatic retrying (sync and async)

resilience4j-cache: Response caching

resilience4j-timelimiter: Timeout handling

Add-on modules

resilience4j-metrics: Dropwizard Metrics exporter

resilience4j-prometheus: Prometheus Metrics exporter

resilience4j-spring-boot: Spring Boot Starter

resilience4j-ratpack: Ratpack Starter

resilience4j-retrofit: Retrofit Call Adapter Factories

resilience4j-vertx: Vertx Future decorator

resilience4j-consumer: Circular Buffer Event consumer
336 questions
3
votes
1 answer

Resilience4J Ratelimiter does not limit access of annotated method

I am using the resilience4j-spring-boot2 library (io.github.resilience4j:resilience4j-spring-boot2, version 1.5.0) and Spring Boot version 2.3.1.RELEASE. I created a RateLimiter which should only let one thread execute a certain method every 30…
GeckStar
  • 1,136
  • 1
  • 14
  • 22
3
votes
0 answers

How to Unit Test Resilience4j circuit breaker fallback methods

I am trying to Unit test the Resilience4j CircuitBreaker configuration for my service. But I am unable to call the fallback method when I throw HttpServerErrorException. However I try to mock the objects the call is not going to the fallback…
Sam
  • 513
  • 1
  • 11
  • 27
3
votes
1 answer

Unclear circuitbreak "fallback" behavior

I want to use a fallback in case of failing, so the behavior in "open" state should be to call a fallback instead of throwing an exception. Problem is that the fallback is called during the "closed" state, while for "open" state I still get the…
Phate
  • 6,066
  • 15
  • 73
  • 138
3
votes
1 answer

Spring Boot Resilience4J Annotation Not Opening Circuit

I've checked the questions on the site about Resilience4J, but have not had any luck with their answers. I'm trying to implement @CircuitBreaker annotation from Resilience4J in my Spring Boot 2.x project. The circuit breaker is implemented around a…
Jeremy Smith
  • 311
  • 2
  • 13
3
votes
1 answer

Wrapping Resilience4j circuitbreaker around a service method with multiple arguments

Resilience4j-circuitbreaker allows us to wrap a service using decorator functions, but from what I can tell it only allows functional interfaces such as Supplier, Consumer, and Function which accept at most 1 input. If I have a service which has a…
P4L
  • 98
  • 3
  • 9
3
votes
1 answer

Is resilience4j required when using Project Reactor?

Project Reactor has features for timeout, retry, fallback functions wrt exceptions, and backpressure. When I'm using Spring WebFlux with Project Reactor in a microservices world with Spring Cloud, do I still need resilience4j? Which features are…
3
votes
1 answer

Resilience4j circuit breaker used with reactive Flux never changes to OPEN on errors

I am evaluating resilience4j to include it in our reactive APIs, so far I am using mock Fluxes. The service below always fails as I want to test if the circuit OPENs on multiple errors: @Service class GamesRepositoryImpl : GamesRepository { …
codependent
  • 23,193
  • 31
  • 166
  • 308
2
votes
1 answer

How to use circuit breaker based on a method parameter?

I have a http client that connects to the same api endpoint on different servers. Which server it connects to, depends on business logic. Let's say the http client method is connect(url). How can I make sure that the circuit breaker takes the url…
2
votes
1 answer

How to configure the retryOnResultPredicate in resilience4j?

I want to set failAfterMaxAttempts to true to get the MaxRetriesExceededException at the end of max retry. According to the doc we need to set the predicate for retryOnResultPredicate with failAfterMaxAttempts. Can someone help with the example…
2
votes
0 answers

Spring API-gateway | Resilience4j randomly invoking fallback method even if the service is returning proper response

To provide some background, I am trying to implement below architecture. It is from a course provided by "DailyCodeBuffer" on microservices, there are 3 services, order, product and payment. Clients can call the order service and order-service…
2
votes
1 answer

Circuitbreakerevents managment endpoint not found

I have resilience4j config and have managementconfig also. management.endpoint.circuitbreakerevents.enabled=true But I can't see any events because URL not found.…
2
votes
0 answers

Using Resilience4j TimeLimiter on service methods

Previously my project had Hystrix for timeouts. Since after Spring Boot upgrade it turned out that Hystrix is no longer supported/developed I needed alternative. One alternative seems to be Resilience4j but I get…
u4963840
  • 81
  • 1
  • 8
2
votes
1 answer

How to invoke a retry of resilience4j on a spring mono in a spring-reactor and resilience4j when not using annotations

I'm calling a service class method using the transformDeferred method: public Mono getPath(SPathRequest request) { return pathService.getPath(request) .transformDeferred(RetryOperator.of(retry)); } My retry…
omer keynan
  • 135
  • 1
  • 11
2
votes
0 answers

Why do rolled back exceptions on read-only transactions (Spring, JPA) overrule Resilience4j circuit breaker?

We're using Spring transactions with JPA and the Resilience4j library for circuit breakers in our application. Our service, which makes use of the data repositories, has a fallback method defined via the circuit breaker to catch errors and return a…
JanDasWiesel
  • 382
  • 5
  • 14
2
votes
1 answer

Resiliency4j circuit breaker with retry configuration not working

I am using both @CircuitBreaker and @Retry annotations on a service method. When I apply both the configurations, the retry configurations are not taking affect. Below is the configuration: resilience4j: circuitbreaker: instances: …
zilcuanu
  • 3,451
  • 8
  • 52
  • 105