diff --git a/reference/html/README.html b/reference/html/README.html index afbd14f..d7593c4 100644 --- a/reference/html/README.html +++ b/reference/html/README.html @@ -96,25 +96,10 @@ $(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
@Service
-public static class DemoControllerService {
- private RestTemplate rest;
- private CircuitBreakerFactory cbFactory;
-
- public DemoControllerService(RestTemplate rest, CircuitBreakerFactory cbFactory) {
- this.rest = rest;
- this.cbFactory = cbFactory;
- }
-
- public String slow() {
- return cbFactory.create("slow").run(() -> rest.getForObject("/slow", String.class), throwable -> "fallback");
- }
-
-}
-The CircuitBreakerFactory.create API will create an instance of a class called CircuitBreaker.
-The run method takes a Supplier and a Function. The Supplier is the code that you are going to
-wrap in a circuit breaker. The Function is the fallback that will be executed if the circuit
-breaker is tripped. 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.
@Service
-public static class DemoControllerService {
- private ReactiveCircuitBreakerFactory cbFactory;
- private WebClient webClient;
-
-
- public DemoControllerService(WebClient webClient, ReactiveCircuitBreakerFactory cbFactory) {
- this.webClient = webClient;
- this.cbFactory = cbFactory;
- }
-
- public Mono<String> slow() {
- return webClient.get().uri("/slow").retrieve().bodyToMono(String.class).transform(
- it -> cbFactory.create("slow").run(it, throwable -> return Mono.just("fallback")));
- }
-}
-The ReactiveCircuitBreakerFactory.create API will create an instance of a class called ReactiveCircuitBreaker.
-The run method takes with a Mono or Flux and wraps it in a circuit breaker. You can optionally profile
-a fallback Function which will be called if the circuit breaker is tripped and will be passed the Throwable
-that caused the failure.
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 provide a default configuration for all of your circuit breakers create a Customize bean that is passed a
-HystrixCircuitBreakerFactory or ReactiveHystrixCircuitBreakerFactory.
-The configureDefault method can be used to provide a default configuration.
@Bean
-public Customizer<HystrixCircuitBreakerFactory> defaultConfig() {
- return factory -> factory.configureDefault(id -> HystrixCommand.Setter
- .withGroupKey(HystrixCommandGroupKey.Factory.asKey(id))
- .andCommandPropertiesDefaults(HystrixCommandProperties.Setter()
- .withExecutionTimeoutInMilliseconds(4000)));
-}
-@Bean
-public Customizer<ReactiveHystrixCircuitBreakerFactory> defaultConfig() {
- return factory -> factory.configureDefault(id -> HystrixObservableCommand.Setter
- .withGroupKey(HystrixCommandGroupKey.Factory.asKey(id))
- .andCommandPropertiesDefaults(HystrixCommandProperties.Setter()
- .withExecutionTimeoutInMilliseconds(4000)));
-}
-Similarly to providing a default configuration, you can create a Customize bean this is passed a
-HystrixCircuitBreakerFactory
@Bean
-public Customizer<HystrixCircuitBreakerFactory> customizer() {
- return factory -> factory.configure(builder -> builder.commandProperties(
- HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(2000)), "foo", "bar");
-}
-@Bean
-public Customizer<ReactiveHystrixCircuitBreakerFactory> customizer() {
- return factory -> factory.configure(builder -> builder.commandProperties(
- HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(2000)), "foo", "bar");
-}
-There are two starters for the Resilience4J implementations, one for reactive applications and -one for non-reactive applications.
+There are two starters for the Resilience4J implementations, one for reactive applications and one for non-reactive applications.
To provide a default configuration for all of your circuit breakers create a Customize bean that is passed a
Resilience4JCircuitBreakerFactory or ReactiveResilience4JCircuitBreakerFactory.
@@ -397,7 +188,7 @@ public Customizer<Resilience4JCircuitBreakerFactory> defaultCustomizer() {
Similarly to providing a default configuration, you can create a Customize bean this is passed a
Resilience4JCircuitBreakerFactory or ReactiveResilience4JCircuitBreakerFactory.
In addition to configuring the circuit breaker that is created you can also customize the circuit breaker after it
-has been created but before it is returned to the caller. To do this you can use the addCircuitBreakerCustomizer
-method. This can be useful for adding event handlers to Resilience4J circuit breakers.
In addition to configuring the circuit breaker that is created you can also customize the circuit breaker after it has been created but before it is returned to the caller.
+To do this you can use the addCircuitBreakerCustomizer
+method.
+This can be useful for adding event handlers to Resilience4J circuit breakers.
To provide a default configuration for all of your circuit breakers create a Customizer bean that is passed a
SentinelCircuitBreakerFactory or ReactiveSentinelCircuitBreakerFactory.
@@ -502,7 +294,7 @@ You can also choose to load circuit breaking rules later elsewhere using
DegradeRuleManager.loadRules(rules) API of Sentinel, or via Sentinel dashboard.
Similarly to providing a default configuration, you can create a Customizer bean this is passed a
SentinelCircuitBreakerFactory.
Spring Retry provides declarative retry support for Spring applications. A subset of the project -includes the ability to implement circuit breaker functionality. Spring Retry provides a circuit breaker -implementation via a combination of it’s +
Spring Retry provides declarative retry support for Spring applications.
+A subset of the project includes the ability to implement circuit breaker functionality.
+Spring Retry provides a circuit breaker implementation via a combination of it’s
CircuitBreakerRetryPolicy
-and a stateful retry. All circuit
-breakers created using Spring Retry will be created using the CircuitBreakerRetryPolicy and a
+and a stateful retry.
+All circuit breakers created using Spring Retry will be created using the CircuitBreakerRetryPolicy and a
DefaultRetryState.
Both of these classes can be configured using SpringRetryConfigBuilder.
To provide a default configuration for all of your circuit breakers create a Customize bean that is passed a
SpringRetryCircuitBreakerFactory.
@@ -598,7 +390,7 @@ public Customizer<SpringRetryCircuitBreakerFactory> defaultCustomizer() {
Similarly to providing a default configuration, you can create a Customize bean this is passed a
SpringRetryCircuitBreakerFactory.
In addition to configuring the circuit breaker that is created you can also customize the circuit breaker after it
-has been created but before it is returned to the caller. To do this you can use the addRetryTemplateCustomizers
-method. This can be useful for adding event handlers to the RetryTemplate.
In addition to configuring the circuit breaker that is created you can also customize the circuit breaker after it has been created but before it is returned to the caller.
+To do this you can use the addRetryTemplateCustomizers
+method.
+This can be useful for adding event handlers to the RetryTemplate.
There are two starters for the Resilience4J implementations, one for reactive applications and -one for non-reactive applications.
+There are two starters for the Resilience4J implementations, one for reactive applications and one for non-reactive applications.
In addition to configuring the circuit breaker that is created you can also customize the circuit breaker after it
-has been created but before it is returned to the caller. To do this you can use the addCircuitBreakerCustomizer
-method. This can be useful for adding event handlers to Resilience4J circuit breakers.
In addition to configuring the circuit breaker that is created you can also customize the circuit breaker after it has been created but before it is returned to the caller.
+To do this you can use the addCircuitBreakerCustomizer
+method.
+This can be useful for adding event handlers to Resilience4J circuit breakers.
Spring Retry provides declarative retry support for Spring applications. A subset of the project -includes the ability to implement circuit breaker functionality. Spring Retry provides a circuit breaker -implementation via a combination of it’s +
Spring Retry provides declarative retry support for Spring applications.
+A subset of the project includes the ability to implement circuit breaker functionality.
+Spring Retry provides a circuit breaker implementation via a combination of it’s
CircuitBreakerRetryPolicy
-and a stateful retry. All circuit
-breakers created using Spring Retry will be created using the CircuitBreakerRetryPolicy and a
+and a stateful retry.
+All circuit breakers created using Spring Retry will be created using the CircuitBreakerRetryPolicy and a
DefaultRetryState.
Both of these classes can be configured using SpringRetryConfigBuilder.
In addition to configuring the circuit breaker that is created you can also customize the circuit breaker after it
-has been created but before it is returned to the caller. To do this you can use the addRetryTemplateCustomizers
-method. This can be useful for adding event handlers to the RetryTemplate.
In addition to configuring the circuit breaker that is created you can also customize the circuit breaker after it has been created but before it is returned to the caller.
+To do this you can use the addRetryTemplateCustomizers
+method.
+This can be useful for adding event handlers to the RetryTemplate.
0.0.1.BUILD-SNAPSHOT
-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
@Service
-public static class DemoControllerService {
- private RestTemplate rest;
- private CircuitBreakerFactory cbFactory;
-
- public DemoControllerService(RestTemplate rest, CircuitBreakerFactory cbFactory) {
- this.rest = rest;
- this.cbFactory = cbFactory;
- }
-
- public String slow() {
- return cbFactory.create("slow").run(() -> rest.getForObject("/slow", String.class), throwable -> "fallback");
- }
-
-}
-The CircuitBreakerFactory.create API will create an instance of a class called CircuitBreaker.
-The run method takes a Supplier and a Function. The Supplier is the code that you are going to
-wrap in a circuit breaker. The Function is the fallback that will be executed if the circuit
-breaker is tripped. 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.
@Service
-public static class DemoControllerService {
- private ReactiveCircuitBreakerFactory cbFactory;
- private WebClient webClient;
-
-
- public DemoControllerService(WebClient webClient, ReactiveCircuitBreakerFactory cbFactory) {
- this.webClient = webClient;
- this.cbFactory = cbFactory;
- }
-
- public Mono<String> slow() {
- return webClient.get().uri("/slow").retrieve().bodyToMono(String.class).transform(
- it -> cbFactory.create("slow").run(it, throwable -> return Mono.just("fallback")));
- }
-}
-The ReactiveCircuitBreakerFactory.create API will create an instance of a class called ReactiveCircuitBreaker.
-The run method takes with a Mono or Flux and wraps it in a circuit breaker. You can optionally profile
-a fallback Function which will be called if the circuit breaker is tripped and will be passed the Throwable
-that caused the failure.
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 provide a default configuration for all of your circuit breakers create a Customize bean that is passed a
-HystrixCircuitBreakerFactory or ReactiveHystrixCircuitBreakerFactory.
-The configureDefault method can be used to provide a default configuration.
@Bean
-public Customizer<HystrixCircuitBreakerFactory> defaultConfig() {
- return factory -> factory.configureDefault(id -> HystrixCommand.Setter
- .withGroupKey(HystrixCommandGroupKey.Factory.asKey(id))
- .andCommandPropertiesDefaults(HystrixCommandProperties.Setter()
- .withExecutionTimeoutInMilliseconds(4000)));
-}
-@Bean
-public Customizer<ReactiveHystrixCircuitBreakerFactory> defaultConfig() {
- return factory -> factory.configureDefault(id -> HystrixObservableCommand.Setter
- .withGroupKey(HystrixCommandGroupKey.Factory.asKey(id))
- .andCommandPropertiesDefaults(HystrixCommandProperties.Setter()
- .withExecutionTimeoutInMilliseconds(4000)));
-}
-Similarly to providing a default configuration, you can create a Customize bean this is passed a
-HystrixCircuitBreakerFactory
@Bean
-public Customizer<HystrixCircuitBreakerFactory> customizer() {
- return factory -> factory.configure(builder -> builder.commandProperties(
- HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(2000)), "foo", "bar");
-}
-@Bean
-public Customizer<ReactiveHystrixCircuitBreakerFactory> customizer() {
- return factory -> factory.configure(builder -> builder.commandProperties(
- HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(2000)), "foo", "bar");
-}
-1.0.0.BUILD-SNAPSHOT
There are two starters for the Resilience4J implementations, one for reactive applications and -one for non-reactive applications.
+There are two starters for the Resilience4J implementations, one for reactive applications and one for non-reactive applications.
To provide a default configuration for all of your circuit breakers create a Customize bean that is passed a
Resilience4JCircuitBreakerFactory or ReactiveResilience4JCircuitBreakerFactory.
@@ -376,7 +167,7 @@ public Customizer<Resilience4JCircuitBreakerFactory> defaultCustomizer() {
Similarly to providing a default configuration, you can create a Customize bean this is passed a
Resilience4JCircuitBreakerFactory or ReactiveResilience4JCircuitBreakerFactory.
In addition to configuring the circuit breaker that is created you can also customize the circuit breaker after it
-has been created but before it is returned to the caller. To do this you can use the addCircuitBreakerCustomizer
-method. This can be useful for adding event handlers to Resilience4J circuit breakers.
In addition to configuring the circuit breaker that is created you can also customize the circuit breaker after it has been created but before it is returned to the caller.
+To do this you can use the addCircuitBreakerCustomizer
+method.
+This can be useful for adding event handlers to Resilience4J circuit breakers.
To provide a default configuration for all of your circuit breakers create a Customizer bean that is passed a
SentinelCircuitBreakerFactory or ReactiveSentinelCircuitBreakerFactory.
@@ -481,7 +273,7 @@ You can also choose to load circuit breaking rules later elsewhere using
DegradeRuleManager.loadRules(rules) API of Sentinel, or via Sentinel dashboard.
Similarly to providing a default configuration, you can create a Customizer bean this is passed a
SentinelCircuitBreakerFactory.
Spring Retry provides declarative retry support for Spring applications. A subset of the project -includes the ability to implement circuit breaker functionality. Spring Retry provides a circuit breaker -implementation via a combination of it’s +
Spring Retry provides declarative retry support for Spring applications.
+A subset of the project includes the ability to implement circuit breaker functionality.
+Spring Retry provides a circuit breaker implementation via a combination of it’s
CircuitBreakerRetryPolicy
-and a stateful retry. All circuit
-breakers created using Spring Retry will be created using the CircuitBreakerRetryPolicy and a
+and a stateful retry.
+All circuit breakers created using Spring Retry will be created using the CircuitBreakerRetryPolicy and a
DefaultRetryState.
Both of these classes can be configured using SpringRetryConfigBuilder.
To provide a default configuration for all of your circuit breakers create a Customize bean that is passed a
SpringRetryCircuitBreakerFactory.
@@ -577,7 +369,7 @@ public Customizer<SpringRetryCircuitBreakerFactory> defaultCustomizer() {
Similarly to providing a default configuration, you can create a Customize bean this is passed a
SpringRetryCircuitBreakerFactory.
In addition to configuring the circuit breaker that is created you can also customize the circuit breaker after it
-has been created but before it is returned to the caller. To do this you can use the addRetryTemplateCustomizers
-method. This can be useful for adding event handlers to the RetryTemplate.
In addition to configuring the circuit breaker that is created you can also customize the circuit breaker after it has been created but before it is returned to the caller.
+To do this you can use the addRetryTemplateCustomizers
+method.
+This can be useful for adding event handlers to the RetryTemplate.