From 595ed6e26f3919a4ad28881ae9d3e3bb6df760dd Mon Sep 17 00:00:00 2001
From: buildmaster
Spring Cloud Circuit breaker provides an abstraction across different circuit breaker implementations. It provides a consistent API to use in your applications allowing you the developer to choose the circuit breaker implementation that best fits your needs for your app.
To create a circuit breaker in your code you can use the CircuitBreakerFactory API. When you include a Spring Cloud Circuit Breaker starter on your classpath a bean implementing this API will automatically be created for you.
A very simple example of using this API is given below
Function is the fallback that will be executed if the circuit b
The function will be passed the Throwable that caused the fallback to be triggered.
You can optionally exclude the fallback if you do not want to provide one.
If Project Reactor is on the class path then you can also use ReactiveCircuitBreakerFactory for your reactive code.
You can configure your circuit breakers using by creating beans of type Customizer.
The Customizer interface has a single method called customize that takes in the Object to customize.
To see the list of all Spring Cloud Commons related configuration properties please check the Appendix page.
diff --git a/reference/html/spring-cloud-commons.html b/reference/html/spring-cloud-commons.html index 3c68bdba..6d1d3463 100644 --- a/reference/html/spring-cloud-commons.html +++ b/reference/html/spring-cloud-commons.html @@ -154,19 +154,22 @@ $(addBlockSwitches);Spring Cloud Circuit breaker provides an abstraction across different circuit breaker implementations. It provides a consistent API to use in your applications allowing you the developer to choose the circuit breaker implementation that best fits your needs for your app.
To create a circuit breaker in your code you can use the CircuitBreakerFactory API. When you include a Spring Cloud Circuit Breaker starter on your classpath a bean implementing this API will automatically be created for you.
A very simple example of using this API is given below
Function is the fallback that will be executed if the circuit b
The function will be passed the Throwable that caused the fallback to be triggered.
You can optionally exclude the fallback if you do not want to provide one.
If Project Reactor is on the class path then you can also use ReactiveCircuitBreakerFactory for your reactive code.
You can configure your circuit breakers using by creating beans of type Customizer.
The Customizer interface has a single method called customize that takes in the Object to customize.
To see the list of all Spring Cloud Commons related configuration properties please check the Appendix page.