public interface CircuitBreakersPanel
Calls to remote services can make use of this facility in order to add circuit breaking capabilities to it.
Modifier and Type | Method and Description |
---|---|
<T> CompletionStage<T> |
withCircuitBreaker(String id,
Supplier<CompletionStage<T>> body)
Executes
body in the context of the circuit breaker identified by id . |
<T> CompletionStage<T> withCircuitBreaker(String id, Supplier<CompletionStage<T>> body)
body
in the context of the circuit breaker identified by id
. Whether
body.get()
is actually invoked is implementation-dependent, but implementations should
call it at most once.T
- the result typeid
- the unique identifier for the circuit breaker to use (often a service name)body
- effect to (optionally) execute within the context of the circuit breaker. May throw
a RuntimeException
to signal failure.body.get()
, or failing
with an implementation-dependent exception.