From c1c388b251d825c70c982d104255b803a1cb48e9 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Tue, 27 Aug 2019 18:57:47 +0000 Subject: [PATCH] Sync docs from master to gh-pages --- reference/html/index.html | 131 ++++++++++ .../html/spring-cloud-circuitbreaker.html | 233 ++++++++++++++++++ reference/html/spring-cloud-commons.html | 131 ++++++++++ 3 files changed, 495 insertions(+) create mode 100644 reference/html/spring-cloud-circuitbreaker.html diff --git a/reference/html/index.html b/reference/html/index.html index b7f41607..32c55e79 100644 --- a/reference/html/index.html +++ b/reference/html/index.html @@ -125,6 +125,18 @@ $(addBlockSwitches);
  • Spring Cloud Compatibility Verification
  • +
  • Spring Cloud Circuit Breaker
  • +
  • Introduction + +
  • +
  • Core Concepts + +
  • +
  • Configuration
  • @@ -1243,6 +1255,125 @@ of compatible Spring Boot versions.

    +
    +

    Spring Cloud Circuit Breaker

    +
    + +
    +
    +
    +

    Introduction

    +
    +
    +

    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.

    +
    + +
    +
    +
    +

    Core Concepts

    +
    +
    +

    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.

    +
    +
    +

    Circuit Breakers In Reactive Code

    +
    +

    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.

    +
    +
    +
    +
    +
    +

    Configuration

    +
    +
    +

    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.

    +
    +
    +
    diff --git a/reference/html/spring-cloud-circuitbreaker.html b/reference/html/spring-cloud-circuitbreaker.html new file mode 100644 index 00000000..1419a86b --- /dev/null +++ b/reference/html/spring-cloud-circuitbreaker.html @@ -0,0 +1,233 @@ + + + + + + + +Introduction + + + + + + + + + + +
    +
    +

    Introduction

    +
    +
    +

    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.

    +
    + +
    +
    +
    +

    Core Concepts

    +
    +
    +

    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.

    +
    +
    +

    Circuit Breakers In Reactive Code

    +
    +

    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.

    +
    +
    +
    +
    +
    +

    Configuration

    +
    +
    +

    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.

    +
    +
    +
    +
    + + + + + + + \ No newline at end of file diff --git a/reference/html/spring-cloud-commons.html b/reference/html/spring-cloud-commons.html index b7f41607..32c55e79 100644 --- a/reference/html/spring-cloud-commons.html +++ b/reference/html/spring-cloud-commons.html @@ -125,6 +125,18 @@ $(addBlockSwitches);
  • Spring Cloud Compatibility Verification
  • +
  • Spring Cloud Circuit Breaker
  • +
  • Introduction + +
  • +
  • Core Concepts + +
  • +
  • Configuration
  • @@ -1243,6 +1255,125 @@ of compatible Spring Boot versions.

    +
    +

    Spring Cloud Circuit Breaker

    +
    + +
    +
    +
    +

    Introduction

    +
    +
    +

    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.

    +
    + +
    +
    +
    +

    Core Concepts

    +
    +
    +

    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.

    +
    +
    +

    Circuit Breakers In Reactive Code

    +
    +

    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.

    +
    +
    +
    +
    +
    +

    Configuration

    +
    +
    +

    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.

    +
    +
    +