Interface CircuitBreakerMapping
- All Superinterfaces:
ClientCircuitBreakerGenerator<CircuitBreaker>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface CircuitBreakerMapping
extends ClientCircuitBreakerGenerator<CircuitBreaker>
Returns a
CircuitBreaker
instance from remote invocation parameters.-
Method Summary
Modifier and TypeMethodDescriptionstatic CircuitBreakerMappingBuilder
builder()
Returns a builder that builds aCircuitBreakerMapping
by setting host, method and/or path.get
(ClientRequestContext ctx, Request req) Returns theCircuitBreaker
mapped to the given parameters.static CircuitBreakerMapping
Returns the defaultCircuitBreakerMapping
.static CircuitBreakerMapping
perHost
(Function<String, ? extends CircuitBreaker> factory) Creates a newCircuitBreakerMapping
which mapsCircuitBreaker
s with the remote host name.static CircuitBreakerMapping
perHostAndMethod
(BiFunction<String, String, ? extends CircuitBreaker> factory) Creates a newCircuitBreakerMapping
which mapsCircuitBreaker
s with the remote host and method name.static CircuitBreakerMapping
perMethod
(Function<String, ? extends CircuitBreaker> factory) Creates a newCircuitBreakerMapping
which mapsCircuitBreaker
s with method name.static CircuitBreakerMapping
perPath
(Function<String, ? extends CircuitBreaker> factory) Creates a newCircuitBreakerMapping
which mapsCircuitBreaker
s with the request path.
-
Method Details
-
ofDefault
Returns the defaultCircuitBreakerMapping
. -
builder
Returns a builder that builds aCircuitBreakerMapping
by setting host, method and/or path. -
perMethod
Creates a newCircuitBreakerMapping
which mapsCircuitBreaker
s with method name.- Parameters:
factory
- the function that takes a method name and creates a newCircuitBreaker
-
perHost
Creates a newCircuitBreakerMapping
which mapsCircuitBreaker
s with the remote host name.- Parameters:
factory
- the function that takes a host name and creates a newCircuitBreaker
-
perPath
Creates a newCircuitBreakerMapping
which mapsCircuitBreaker
s with the request path.- Parameters:
factory
- the function that takes a path and creates a newCircuitBreaker
-
perHostAndMethod
static CircuitBreakerMapping perHostAndMethod(BiFunction<String, String, ? extends CircuitBreaker> factory) Creates a newCircuitBreakerMapping
which mapsCircuitBreaker
s with the remote host and method name.- Parameters:
factory
- the function that takes the remote host and method name and creates a newCircuitBreaker
-
get
Returns theCircuitBreaker
mapped to the given parameters.- Specified by:
get
in interfaceClientCircuitBreakerGenerator<CircuitBreaker>
- Throws:
Exception
-