From 47682ecc72605d84dd9a3e5d93bdb98ee4a5d13e Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Thu, 11 May 2017 16:06:06 +0200 Subject: [PATCH] fix circuitbreaker.md --- .../src/main/paradox/java/index-utilities.md | 4 +- .../paradox/scala/common/circuitbreaker.md | 92 ++++++++----------- .../src/main/paradox/scala/index-utilities.md | 2 +- 3 files changed, 42 insertions(+), 56 deletions(-) diff --git a/akka-docs/src/main/paradox/java/index-utilities.md b/akka-docs/src/main/paradox/java/index-utilities.md index 3ea96815c1..2729a0fc47 100644 --- a/akka-docs/src/main/paradox/java/index-utilities.md +++ b/akka-docs/src/main/paradox/java/index-utilities.md @@ -7,8 +7,8 @@ * [event-bus](event-bus.md) * [logging](logging.md) * [scheduler](scheduler.md) -* [../scala/common/duration](../scala/common/duration.md) -* [../scala/common/circuitbreaker](../scala/common/circuitbreaker.md) +* [common/duration](common/duration.md) +* [common/circuitbreaker](common/circuitbreaker.md) * [extending-akka](extending-akka.md) @@@ \ No newline at end of file diff --git a/akka-docs/src/main/paradox/scala/common/circuitbreaker.md b/akka-docs/src/main/paradox/scala/common/circuitbreaker.md index 58694c2952..f6811d1ebf 100644 --- a/akka-docs/src/main/paradox/scala/common/circuitbreaker.md +++ b/akka-docs/src/main/paradox/scala/common/circuitbreaker.md @@ -29,60 +29,47 @@ The Akka library provides an implementation of a circuit breaker called ## What do they do? - * - During normal operation, a circuit breaker is in the - *Closed* - state: - : - * Exceptions or calls exceeding the configured *callTimeout* increment a failure counter - * Successes reset the failure count to zero - * When the failure counter reaches a *maxFailures* count, the breaker is tripped into *Open* state - - * - While in - *Open* - state: - : - * All calls fail-fast with a `CircuitBreakerOpenException` - * After the configured *resetTimeout*, the circuit breaker enters a *Half-Open* state - - * - In - *Half-Open* - state: - : - * The first call attempted is allowed through without failing fast - * All other calls fail-fast with an exception just as in *Open* state - * If the first call succeeds, the breaker is reset back to *Closed* state and the *resetTimeout* is reset - * If the first call fails, the breaker is tripped again into the *Open* state (as for exponential backoff circuit breaker, the *resetTimeout* is multiplied by the exponential backoff factor) - - * - State transition listeners: - : - * Callbacks can be provided for every state entry via *onOpen*, *onClose*, and *onHalfOpen* - * These are executed in the `ExecutionContext` provided. - - * - Calls result listeners: - : - * Callbacks can be used eg. to collect statistics about all invocations or to react on specific call results like success, failures or timeouts. - * Supported callbacks are: *onCallSuccess*, *onCallFailure*, *onCallTimeout*, *onCallBreakerOpen*. - * These are executed in the `ExecutionContext` provided. +* During normal operation, a circuit breaker is in the *Closed* state: + + - Exceptions or calls exceeding the configured *callTimeout* increment a failure counter + - Successes reset the failure count to zero + - When the failure counter reaches a *maxFailures* count, the breaker is tripped into *Open* state + +* While in *Open* state: + + - All calls fail-fast with a `CircuitBreakerOpenException` + - After the configured *resetTimeout*, the circuit breaker enters a *Half-Open* state + +* In *Half-Open* state: + + - The first call attempted is allowed through without failing fast + - All other calls fail-fast with an exception just as in *Open* state + - If the first call succeeds, the breaker is reset back to *Closed* state and the *resetTimeout* is reset + - If the first call fails, the breaker is tripped again into the *Open* state (as for exponential backoff circuit breaker, the *resetTimeout* is multiplied by the exponential backoff factor) + +* State transition listeners: + + - Callbacks can be provided for every state entry via *onOpen*, *onClose*, and *onHalfOpen* + - These are executed in the `ExecutionContext` provided. + +* Calls result listeners: + + - Callbacks can be used eg. to collect statistics about all invocations or to react on specific call results like success, failures or timeouts. + - Supported callbacks are: *onCallSuccess*, *onCallFailure*, *onCallTimeout*, *onCallBreakerOpen*. + - These are executed in the `ExecutionContext` provided. -![circuit-breaker-states.png](../images/circuit-breaker-states.png) +![circuit-breaker-states.png](../../images/circuit-breaker-states.png) ## Examples ### Initialization -Here's how a :class: -*CircuitBreaker* - would be configured for: -: - * 5 maximum failures - * a call timeout of 10 seconds - * a reset timeout of 1 minute +Here's how a `CircuitBreaker` would be configured for: + +* 5 maximum failures +* a call timeout of 10 seconds +* a reset timeout of 1 minute #### Scala @@ -131,12 +118,11 @@ However, some applications might requires certain exception to not increase fail sometime we want to increase the failure count even if the call succeeded. Akka circuit breaker provides a way to achieve such use case: -> - * *withCircuitBreaker* - * *withSyncCircuitBreaker* - * *callWithCircuitBreaker* - * *callWithCircuitBreakerCS* - * *callWithSyncCircuitBreaker* +* `withCircuitBreaker` +* `withSyncCircuitBreaker` +* `callWithCircuitBreaker` +* `callWithCircuitBreakerCS` +* `callWithSyncCircuitBreaker` All methods above accepts an argument `defineFailureFn` diff --git a/akka-docs/src/main/paradox/scala/index-utilities.md b/akka-docs/src/main/paradox/scala/index-utilities.md index 3ea96815c1..ecfcc4ea88 100644 --- a/akka-docs/src/main/paradox/scala/index-utilities.md +++ b/akka-docs/src/main/paradox/scala/index-utilities.md @@ -7,7 +7,7 @@ * [event-bus](event-bus.md) * [logging](logging.md) * [scheduler](scheduler.md) -* [../scala/common/duration](../scala/common/duration.md) +* [common/duration](../scala/common/duration.md) * [../scala/common/circuitbreaker](../scala/common/circuitbreaker.md) * [extending-akka](extending-akka.md)