This project aims at demonstrating how to use resillience4j in a spring boot app.
$ mvn clean install
$ cd docker
$ docker-compose up
In Grafana you will have to create a new dashboard and import the file docker/grafana.json
$ cd resilience4j-exchange-rate-proxy
$ mvn spring-boot:run
$ cd resilience4j-store-app
$ mvn spring-boot:run
$ cd resilience4j-store-ui
$ npm start
- Web application : http://localhost:4200/#/
- Actuator : http://localhost:8080/actuator/
- Prometheus : http://localhost:9090/classic/targets#job-store-app
- Grafana : http://localhost:3000/?orgId=1
- Swagger : http://localhost:8080/swagger-ui/#/currency-controller/getExchangeRatesUsingGET
$ ab -n x -c y 'http://127.0.0.1:4200/items?currency=GBP'
where x is the total number of calls and y the number of concurrent users
Given
the exchange rate service is UP
When
$ ab -n 1 -c 1 'http://127.0.0.1:4200/items?currency=GBP'
Then
The call is successful
Given
the exchange rate service is DOWN
When
$ ab -n 1 -c 1 'http://127.0.0.1:4200/items?currency=GBP'
Then
The call is successful with the fallback applied after x retries
Given
the exchange rate service is UP
When
$ ab -n 10 -c 1 'http://127.0.0.1:4200/items?currency=GBP'
Then
The call is successful
Given
the exchange rate service is DOWN
When
$ ab -n 20 -c 1 'http://127.0.0.1:4200/items?currency=GBP'
Then
The calls are successful using the circuit breaker fallback The circuit is open
Given
the exchange rate service is UP and the rate limiter is disabled
When
$ ab -n 100 -c 10 'http://127.0.0.1:4200/items?currency=GBP'
Then
The calls are successful
Given
the exchange rate service is UP and the rate limiter is disabled
When
$ ab -n 100 -c 11 'http://127.0.0.1:4200/items?currency=GBP'
Then
The calls are successful, but the fallback has been used for some calls
Given
the exchange rate service is UP
When
$ ab -n 10 -c 1 'http://127.0.0.1:4200/items?currency=GBP'
Then
The calls are successful
Given
the exchange rate service is UP
When
$ ab -n 20 -c 1 'http://127.0.0.1:4200/items?currency=GBP'
Then
The calls are successful, but the fallback has been called for half of them
- Resilience4j doc : https://resilience4j.readme.io/docs
- Resilience4j repository : https://github.com/resilience4j/resilience4j
- Prometheus : https://prometheus.io/
- Grafana : https://grafana.com/
- Exchange rate free api : https://exchangerate.host/#/