{"id":21877635,"url":"https://github.com/rbiedrawa/spring-circuitbreaker-demo","last_synced_at":"2026-04-07T22:31:27.330Z","repository":{"id":162193114,"uuid":"355621184","full_name":"rbiedrawa/spring-circuitbreaker-demo","owner":"rbiedrawa","description":"This repository demonstrates how to build fault-tolerant application and apply resiliency patterns using Resilience4j.","archived":false,"fork":false,"pushed_at":"2022-03-03T12:13:32.000Z","size":565,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-21T00:35:15.081Z","etag":null,"topics":["circuit-breaker","docker","docker-compose","gradle","grafana","grafana-dashboard","java","metrics","micrometer","prometheus","reactive-programming","reactor","resilience4j","resiliency","resiliency-patterns","spring-boot","spring-cloud-circuitbreaker"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rbiedrawa.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-07T16:59:24.000Z","updated_at":"2024-04-19T08:07:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"bf06ed8c-a43b-4fd3-bbfc-42ccfaa1bdde","html_url":"https://github.com/rbiedrawa/spring-circuitbreaker-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rbiedrawa/spring-circuitbreaker-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbiedrawa%2Fspring-circuitbreaker-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbiedrawa%2Fspring-circuitbreaker-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbiedrawa%2Fspring-circuitbreaker-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbiedrawa%2Fspring-circuitbreaker-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rbiedrawa","download_url":"https://codeload.github.com/rbiedrawa/spring-circuitbreaker-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbiedrawa%2Fspring-circuitbreaker-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31532187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circuit-breaker","docker","docker-compose","gradle","grafana","grafana-dashboard","java","metrics","micrometer","prometheus","reactive-programming","reactor","resilience4j","resiliency","resiliency-patterns","spring-boot","spring-cloud-circuitbreaker"],"created_at":"2024-11-28T08:09:50.452Z","updated_at":"2026-04-07T22:31:27.311Z","avatar_url":"https://github.com/rbiedrawa.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring Boot Circuit Breaker (resilience4j demo)\n\nThis repository demonstrates how to build fault-tolerant application and apply resiliency patterns using Resilience4j.\n\n## Features\n\n* Example of most common resilience patterns (circuit breaker, retry, bulkhead and time limiter).\n* Metrics.\n* Micrometer/Prometheus integration.\n* Resilience4j Grafana dashboard.\n* Docker compose running demo.\n\n## Application Diagram\n\n![application-diagram.png](./_docs/img/application-diagram.png)\n\n## Getting Started\n\n### Prerequisites\n\n* Java 11\n* Docker\n* Docker-Compose\n* [ab](https://httpd.apache.org/docs/2.4/programs/ab.html) - Apache HTTP server benchmarking tool\n\n### Installation\n\nBuild docker image.\n\n```shell\n./gradlew bootBuildImage\n```\n\n### Usage\n\n* Start docker compose (keycloak and postgres)\n  ```shell\n  cd docker\n  \n  docker-compose up -d\n  ```\n\n* List containers and check if all are *Up*.\n  ```shell\n  docker-compose ps   \n\n  #        Name                      Command                  State               Ports         \n  # --------------------------------------------------------------------------------------------\n  # circuitbreaker-demo   /cnb/process/web                 Up             0.0.0.0:8080-\u003e8080/tcp\n  # grafana               /run.sh                          Up (healthy)   0.0.0.0:3000-\u003e3000/tcp\n  # prometheus            /bin/prometheus --config.f ...   Up (healthy)   0.0.0.0:9090-\u003e9090/tcp\n  ```\n\n* Generate website traffic using [Apache Benchmark](https://httpd.apache.org/docs/2.4/programs/ab.html) tool.\n  ```shell\n  # Circuit Breaker - `sayHello`\n  ab -t 60 -c 20 http://localhost:8080/api/hello?name=ab_test\n  \n  # Circuit Breaker - `success` \n  ab -t 30 -c 10 http://localhost:8080/api/hello/success\n  ```\n\n* Open your web browser and go to Grafana [login page](http://localhost:3000/). Inside the login page, enter `admin` for a\n  username and password.\n\n* Open `demo/Resilience4j` dashboard. You should be able to see circuit breaker metrics as shown below:\n  ![resiliency4j-dashboard.png](./_docs/img/resiliency4j-dashboard.png)\n\n* Stop demo and cleanup volumes.\n  ```shell\n  docker-compose down -v\n  ```\n\n## Important Endpoints\n\n| Name | Endpoint | \n| -------------:|:--------:|\n| `Demo application` | http://localhost:8080 |\n| `Prometheus` | http://localhost:9090/ |\n| `Grafana` | http://localhost:3000/ |\n| `Actuator endpoint` | http://localhost:8080/actuator |\n| `Bulkheads - Actuator` | http://localhost:8080/actuator/bulkheads |\n| `Bulkheads events - Actuator` | http://localhost:8080/actuator/bulkheadevents |\n| `Micrometer Prometheus - Actuator` | http://localhost:8080/actuator/prometheus |\n| `Circuit breakers - Actuator` | http://localhost:8080/actuator/circuitbreakers |\n| `Circuit breakers events - Actuator` | http://localhost:8080/actuator/circuitbreakerevents |\n| `Rate limiters - Actuator` | http://localhost:8080/actuator/ratelimiters |\n| `Rate limiters events - Actuator` | http://localhost:8080/actuator/ratelimiterevents |\n| `Retries - Actuator` | http://localhost:8080/actuator/retries |\n| `Retries events - Actuator` | http://localhost:8080/actuator/retryevents |\n| `Time limiters - Actuator` | http://localhost:8080/actuator/timelimiters |\n| `Time limiters events - Actuator` | http://localhost:8080/actuator/timelimiterevents |\n| `Actuator health` | http://localhost:8080/actuator/health |\n\n## Additional tips\n\n### Replacing java annotations with custom resiliency4j operator.\n\n```java\nimport io.github.resilience4j.circuitbreaker.CircuitBreaker;\nimport io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;\nimport io.github.resilience4j.reactor.circuitbreaker.operator.CircuitBreakerOperator;\nimport reactor.core.publisher.Mono;\n\n// example how to decorate a Mono using custom Reactor operator.\npublic class IfYouHateAnnotationsServiceExample {\n\n\tprivate final CircuitBreaker circuitBreaker;\n\n\tpublic IfYouHateAnnotationsServiceExample(CircuitBreakerRegistry circuitBreakerRegistry) {\n\t\tcircuitBreaker = circuitBreakerRegistry.circuitBreaker(\"hello_world\");\n\t}\n\n\tMono\u003cString\u003e helloWorld() {\n\t\treturn Mono.fromCallable(() -\u003e \"Hello World!\")\n\t\t\t\t   .transformDeferred(CircuitBreakerOperator.of(circuitBreaker));\n\t}\n}\n```\n\n## References\n\nFor further reference, please consider the following sections:\n\n* [Application resiliency patterns](https://docs.microsoft.com/en-us/dotnet/architecture/cloud-native/application-resiliency-patterns)\n* [Resilience4J](https://docs.spring.io/spring-cloud-circuitbreaker/docs/current/reference/html/index.html)\n* [Getting started with resilience4j-spring-boot2](https://resilience4j.readme.io/docs/getting-started-3)\n* [Examples of resilience4j-reactor](https://resilience4j.readme.io/docs/examples-1)\n* [Resilience4j Grafana Dashboard](https://resilience4j.readme.io/docs/grafana-1)\n* [Prometheus](https://docs.spring.io/spring-boot/docs/2.4.4/reference/html/production-ready-features.html#production-ready-metrics-export-prometheus)\n\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbiedrawa%2Fspring-circuitbreaker-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frbiedrawa%2Fspring-circuitbreaker-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbiedrawa%2Fspring-circuitbreaker-demo/lists"}