All Projects → spring-cloud-samples → spring-cloud-circuitbreaker-demo

spring-cloud-samples / spring-cloud-circuitbreaker-demo

Licence: Apache-2.0 license
Samples demonstrating how to using Spring Cloud Circuitbreaker

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to spring-cloud-circuitbreaker-demo

Home
This is the old home for the Steeltoe project. Please refer to the SteeltoeOSS/steeltoe repository moving forward.
Stars: ✭ 49 (+13.95%)
Mutual labels:  spring-cloud, circuit-breaker
course-spring-microservices
Code examples built for the purpose of video course: Microservices With Spring Boot And Spring Cloud
Stars: ✭ 74 (+72.09%)
Mutual labels:  spring-cloud, circuit-breaker
Spring Cloud Alibaba
Spring Cloud Alibaba provides a one-stop solution for application development for the distributed solutions of Alibaba middleware.
Stars: ✭ 20,934 (+48583.72%)
Mutual labels:  spring-cloud, circuit-breaker
MicroPython-Samples
📚 Provide many interesting MicroPython Code.
Stars: ✭ 51 (+18.6%)
Mutual labels:  samples
atata-samples
Automation test samples based on Atata Framework
Stars: ✭ 39 (-9.3%)
Mutual labels:  samples
spring-cloud-dataflow-server-openshift
This project provides a Spring Cloud Data Flow server for deployments to OpenShift 3
Stars: ✭ 26 (-39.53%)
Mutual labels:  spring-cloud
samples
Learn about Spice.ai with in-depth samples
Stars: ✭ 16 (-62.79%)
Mutual labels:  samples
mica-auto
mica-auto 使用注解自动生成 java spi 和 Spring boot 的配置。🔝🔝 记得右上角点个star 关注更新!
Stars: ✭ 122 (+183.72%)
Mutual labels:  spring-cloud
sample-testing-microservices
sample applications with implementation of unit, component, contract and integrarion tests using pact, gatling, spring boot test and hoverfly
Stars: ✭ 22 (-48.84%)
Mutual labels:  spring-cloud
monthlyresources
Use this repository to explore the latest content and code samples. Each month we will release best of content resources that relate to a particular theme. - Microsoft Developer Editorial team
Stars: ✭ 198 (+360.47%)
Mutual labels:  spring-cloud
easeagent
An agent component for the Java system
Stars: ✭ 437 (+916.28%)
Mutual labels:  spring-cloud
shell-samples
No description or website provided.
Stars: ✭ 14 (-67.44%)
Mutual labels:  samples
bitmovin-player-web-samples
Showcases build around the Bitmovin Adaptive Streaming Player, demonstrating usage and capabilities of the HTML5 based HLS and MPEG-DASH player, as well as the Flash based Fallback.
Stars: ✭ 69 (+60.47%)
Mutual labels:  samples
cloud-build-samples
Code snippets used in Cloud Build documentation
Stars: ✭ 63 (+46.51%)
Mutual labels:  samples
Cloud-Native-App-Spring-Boot
A Cloud Native App with Spring Coud Security with KeyCloak Auth Server, API Gateway Server, Naming Server, Config Server and Distributed Tracing and ELK Stack hosted in K8s
Stars: ✭ 19 (-55.81%)
Mutual labels:  spring-cloud
gobreak
Latency and fault tolerance library like Netflix's Hystrix with prometheus and gobreaker.
Stars: ✭ 42 (-2.33%)
Mutual labels:  circuit-breaker
smile-monitor-starter
Microservice system monitoring
Stars: ✭ 49 (+13.95%)
Mutual labels:  spring-cloud
CoSky
High-performance, low-cost microservice governance platform. Service Discovery and Configuration Service | 高性能、低成本微服务治理平台
Stars: ✭ 57 (+32.56%)
Mutual labels:  spring-cloud
frontend-sample-showcase
No description or website provided.
Stars: ✭ 16 (-62.79%)
Mutual labels:  samples
WebDAVServerSamplesJava
WebDAV server examples in Java based on IT Hit WebDAV Server Library for Java
Stars: ✭ 38 (-11.63%)
Mutual labels:  samples

About

This repo contains a collection of apps that demonstrate how to using Spring Cloud CircuitBreaker with various circuit breaker implementations.

Non-Reactive Samples

There are two non-reactive samples in this repo, spring-cloud-circuitbreaker-hystrix and spring-cloud-circuitbreaker-resilience4j.

When these apps are running there are two endpoints available for testing

  1. /get - This endpoint makes a request to httpbin's /get endpoint and returns the data

  2. /delay/{seconds} - This endpoint makes a request to httpbin's /delay endpoint passing the delay in the response in seconds. Since this request can take a significant amount of time it is wrapped in a circuit breaker. If the seconds parameter is greater than or equal to 3 the circuit breaker will time out and return the response {"hello": "world"}.

Reactive Samples

There are three reactive samples in this repo, spring-cloud-circuitbreaker-demo-reactive, spring-cloud-circuitbreaker-demo-reactive-hystrix, and spring-cloud-circuibreaker-demo-reactive-resilience4j.

Hystrix and Resilience4J Reactive Samples

Both of these samples contain the same two endpoints as the non-reactive samples (which in this case return a Mono), but also contain an additional endpoint to demonstrate the use of Flux. This endpoint can be accessed by calling /fluxdelay/{seconds}. It has the same functionality as /delay/{seconds} but the fallback returns a Flux.

spring-cloud-circuitbreaker-demo-reactive

This sample demonstrates how to using Spring Cloud CircuitBreaker with reactive types from RxJava2 and CompletableFuture. There are four endpoints available for testing in this app

  1. /rxjava2/get
  2. /rxjava2/delay/{seconds}
  3. /completablefuture/get
  4. /completablefuture/delay/{seconds}

Each of these have the same functionality as the other endpoints in the other apps.

Resilience4J and Metrics

With Spring Cloud CircuitBreaker and Resilience4J you can easily collect metrics about the circuit breakers in your app. This is demoed in both spring-cloud-circuitbreaker-demo-resilience4j and spring-cloud-circuitbreaker-demo-reactive-resilience4j. You can see the metrics available by hitting /actuator/metrics.

NOTE: The code wrapped by the circuit breaker needs to be executed before any metrics appear

You can also have these metrics collected by Prometheus and visualized in Grafana. To demonstrate this, the repo contains a Docker Compose file that will start Prometheus and Grafana locally and scrape the metrics being surfaces at /actuator/prometheus. To see it in action

  1. Start either spring-cloud-circuitbreaker-demo-resilience4j or spring-cloud-circuitbreaker-demo-reactive-resilience4j.
  2. cd into the grafana directory in the root of the repo
  3. Run docker-compose up
  4. Go to http://localhost:3000 and login with the username admin and the password admin
  5. There will be a datasource pointing to the docker container running Prometheus and dashboard already configured to visualize the Resilience4J metrics
  6. Make some requests to the /delay endpoint. You can easily do this with a tool like watch. For example watch -n 1 http :8080/delay/5.
  7. If you refresh the Grafana dashboard or set its automatic refresh you should see the graphs begin to change as requests are made.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].