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
1
vote
0 answers

I need to setup ratelimiting in controller level for an API's but with certain condition check wheather have to apply ratelimiting or not

Till now I have setup these, but it result in ratelimiting without any conditions resilience4j.ratelimiter: instances: basic: limitForPeriod: ${RATE_LIMIT_PERMISIBLE_HITS:1000} limitRefreshPeriod: ${RATE_LIMIT_REFRESH_RATE:1h} …
1
vote
0 answers

How can I implement the circuit breaker pattern and retry pattern at the same time using Resilience4j with Spring Boot and microservices?

I'm doing a project using Spring Boot and Micro-services architecture. I have two micro-services one calling the other to process a request from API gateway. I'm trying to implement the circuit breaker pattern and retry pattern at the same time…
1
vote
1 answer

PromQL to find the number of timeouts/failures across all instances over a period of time

Spring-boot application exposing the metrics, resilience4j_timelimiter_calls_total, seems to be counter, which is giving me the total timeouts happened till the current time.` I have used sum by (service, name)…
tusharRawat
  • 719
  • 10
  • 24
1
vote
2 answers

Why Retry is not triggered when I use resilience4j functional configuration?

I had successful experiments with spring boot configuration for resillence4j but I want to try functional configuration. So I have implemented following code: RetryConfig config = RetryConfig.custom() .maxAttempts(6) …
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
1
vote
1 answer

What happens if there are less calls than the number in permittedNumberOfCallsInHalfOpenState during the maxWaitDurationInHalfOpenState?

did not find this information elsewhere in the documentation, what happens if there are less calls than the number in permittedNumberOfCallsInHalfOpenState during the maxWaitDurationInHalfOpenState? does it calculate failure rate from the made calls…
1
vote
1 answer

Can I implement an own decorator for resilience4j to optimize rate limiting?

I want to optimize the resilience4j rate limiter to allow a rate limiting per user a staggered rate limiting (like 1 call/second but only 30 calls/minute but only 1000 calls/hour). This should protect a resource from DOS attacks but not limit the…
Datz
  • 3,156
  • 3
  • 22
  • 50
1
vote
0 answers

Spring Cloud Gateway with Resilience4J Circuit Breaker did not go to open state

While attempting to integrate Resilience4J with Spring Cloud Gateway, some features such as retry appear to be working properly, but the Circuit Breaker did not open the state although failure was counted as shown at below screenshot. @Bean public…
1
vote
1 answer

Java Spring rate limiter block specific duration when ratio reached

Currently I have a requirement: Apply rate limiter for an API. If this API get called over 100 times per 5 sec then the API will be blocked for 10 mins. I don't know if there is any java lib can fullfill this requirement. If the requirement is…
SoT
  • 898
  • 1
  • 15
  • 36
1
vote
0 answers

Updating the Resilience4j CircuitBreaker Properties in Micronaut while the app is running

Resilience4j version: 1.7.1 Java version: 11 Micronaut version: 3.2.7 Can we change the CircuitBreaker Properties of an instance dynamically while the application is running? The following returns an existing Bean or creates a new one. /** *…
1
vote
1 answer

Resilience4j Circuit Breaker behaviour in Distributed system

I have integrated the Resilience4j circuit breaker in one of the spring boot applications that have multiple pods on K8s. There are a couple of questions that I need to know How do I track the circuit breaker status from the actuator on each pod,…
1
vote
0 answers

Resilience4j circuit breaker: not working when it is used with Decorators

I am trying to implement Resilience4j programmatically and also forced state transition through a rest endpoint. But unfortunately Circuit Breaker is not working when I use Decorator. Interesting;y it works when I use this with WebClient. My…
Thomson Mathew
  • 419
  • 1
  • 9
  • 28
1
vote
1 answer

Kotlin Flow with Resilience4j RateLimiter and Retry

I have Resilience4j version: 1.7.1, Kotlin version: 1.7.0, Kotlin Coroutines: 1.6.1. I'd like to use RateLimiter and Retry in kotlin code, but documentations don't contain information how to use Kotlin Flow with them. I have a simple code: suspend…
1
vote
0 answers

Reading the values from a custom yml file which hold resilience4j configration

I have a custom yml file configuration that holds the configs needed for the circuit breaker implemented in resilience4j. resilience4j: circuitbreaker: instances: serviceA: eventConsumerBufferSize: 3 failureRateThreshold: 50 minimumNumberOfCalls:…
Vivekann
  • 11
  • 2
1
vote
1 answer

Resilience4j circuit breaker does not switch back to closed state from half open after the downstream system is up again

I have two micro-services, order-service, and inventory-service. The order-service makes a call to inventory-service to check if ordered items are in stock. An order is placed only if all the items in the order request are in stock. If the…
Chan
  • 651
  • 2
  • 8
  • 15
1
vote
0 answers

Migrate from HystrixCommand to Resilience4j

Resilience4j version: 1.7.0 Java version: 1.8 I have challenge in implementing TimeLimiter feature of Resilience4j. I am able to get the Circuit Breaker (CB) work. We have 2 services Lets say serviceA and serviceB. We have used Command design…
Vinay
  • 11
  • 3