Class CircuitBreaker
- All Implemented Interfaces:
MutinyDelegate
original
non Mutiny-ified interface using Vert.x codegen.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCircuitBreaker
(io.vertx.circuitbreaker.CircuitBreaker delegate) CircuitBreaker
(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionclose()
closeHandler
(Runnable handler) static CircuitBreaker
static CircuitBreaker
boolean
<T> io.smallrye.mutiny.Uni<T>
execute
(io.smallrye.mutiny.Uni<T> command) Same asexecuteWithFallback(io.smallrye.mutiny.Uni<T>, java.util.function.Function<java.lang.Throwable, T>)
but using the circuit breaker default fallback.<T> T
executeAndAwait
(io.smallrye.mutiny.Uni<T> command) Blocking variant ofexecute(Consumer)
.<T> void
executeAndForget
(io.smallrye.mutiny.Uni<T> command) Variant ofexecute(Consumer)
that ignores the result of the operation.<T> CircuitBreaker
executeAndReport
(Promise<T> resultPromise, io.smallrye.mutiny.Uni<T> command) <T> CircuitBreaker
executeAndReportWithFallback
(Promise<T> resultPromise, io.smallrye.mutiny.Uni<T> command, Function<Throwable, T> fallback) <T> io.smallrye.mutiny.Uni<T>
executeWithFallback
(io.smallrye.mutiny.Uni<T> command, Function<Throwable, T> fallback) Same asexecuteWithFallback(io.smallrye.mutiny.Uni<T>, java.util.function.Function<java.lang.Throwable, T>)
but using a callback.<T> T
executeWithFallbackAndAwait
(io.smallrye.mutiny.Uni<T> command, Function<Throwable, T> fallback) Blocking variant ofexecuteWithFallback(Consumer,Function)
.<T> void
executeWithFallbackAndForget
(io.smallrye.mutiny.Uni<T> command, Function<Throwable, T> fallback) Variant ofexecuteWithFallback(Consumer,Function)
that ignores the result of the operation.long
<T> CircuitBreaker
failurePolicy
(FailurePolicy<T> failurePolicy) <T> CircuitBreaker
io.vertx.circuitbreaker.CircuitBreaker
halfOpenHandler
(Runnable handler) int
hashCode()
name()
static CircuitBreaker
newInstance
(io.vertx.circuitbreaker.CircuitBreaker arg) open()
openHandler
(Runnable handler) reset()
retryPolicy
(RetryPolicy retryPolicy) retryPolicy
(Function<Integer, Long> retryPolicy) Deprecated.io.vertx.circuitbreaker.CircuitBreakerState
state()
toString()
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
CircuitBreaker
public CircuitBreaker(io.vertx.circuitbreaker.CircuitBreaker delegate) -
CircuitBreaker
-
-
Method Details
-
getDelegate
public io.vertx.circuitbreaker.CircuitBreaker getDelegate()- Specified by:
getDelegate
in interfaceMutinyDelegate
- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
create
public static CircuitBreaker create(String name, Vertx vertx, io.vertx.circuitbreaker.CircuitBreakerOptions options) - Parameters:
name
- the namevertx
- the Vert.x instanceoptions
- the configuration option- Returns:
- the created instance
-
create
- Parameters:
name
- the namevertx
- the Vert.x instance- Returns:
- the created instance
-
close
- Returns:
- the instance of CircuitBreaker to chain method calls.
-
openHandler
- Parameters:
handler
- the handler, must not benull
- Returns:
-
halfOpenHandler
- Parameters:
handler
- the handler, must not benull
- Returns:
-
closeHandler
- Parameters:
handler
- the handler, must not benull
- Returns:
-
executeWithFallback
@CheckReturnValue public <T> io.smallrye.mutiny.Uni<T> executeWithFallback(io.smallrye.mutiny.Uni<T> command, Function<Throwable, T> fallback) Same asexecuteWithFallback(io.smallrye.mutiny.Uni<T>, java.util.function.Function<java.lang.Throwable, T>)
but using a callback.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
command
- the operationfallback
- the fallback- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
executeWithFallbackAndAwait
public <T> T executeWithFallbackAndAwait(io.smallrye.mutiny.Uni<T> command, Function<Throwable, T> fallback) Blocking variant ofexecuteWithFallback(Consumer,Function)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
command
- the operationfallback
- the fallback- Returns:
- the T instance produced by the operation.
-
executeWithFallbackAndForget
public <T> void executeWithFallbackAndForget(io.smallrye.mutiny.Uni<T> command, Function<Throwable, T> fallback) Variant ofexecuteWithFallback(Consumer,Function)
that ignores the result of the operation.This method subscribes on the result of
executeWithFallback(Consumer,Function)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromexecuteWithFallback(Consumer,Function)
but you don't need to compose it with other operations.- Parameters:
command
- the operationfallback
- the fallback
-
execute
@CheckReturnValue public <T> io.smallrye.mutiny.Uni<T> execute(io.smallrye.mutiny.Uni<T> command) Same asexecuteWithFallback(io.smallrye.mutiny.Uni<T>, java.util.function.Function<java.lang.Throwable, T>)
but using the circuit breaker default fallback.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
command
- the operation- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
executeAndAwait
public <T> T executeAndAwait(io.smallrye.mutiny.Uni<T> command) Blocking variant ofexecute(Consumer)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
command
- the operation- Returns:
- the T instance produced by the operation.
-
executeAndForget
public <T> void executeAndForget(io.smallrye.mutiny.Uni<T> command) Variant ofexecute(Consumer)
that ignores the result of the operation.This method subscribes on the result of
execute(Consumer)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromexecute(Consumer)
but you don't need to compose it with other operations.- Parameters:
command
- the operation
-
executeAndReport
public <T> CircuitBreaker executeAndReport(Promise<T> resultPromise, io.smallrye.mutiny.Uni<T> command) - Parameters:
resultPromise
- the promise on which the operation result is reportedcommand
- the operation- Returns:
-
executeAndReportWithFallback
public <T> CircuitBreaker executeAndReportWithFallback(Promise<T> resultPromise, io.smallrye.mutiny.Uni<T> command, Function<Throwable, T> fallback) - Parameters:
resultPromise
- the promise on which the operation result is reportedcommand
- the operationfallback
- the fallback function. It gets an exception as parameter and returns the fallback result- Returns:
- the current
CircuitBreaker
-
fallback
- Parameters:
handler
- the handler- Returns:
- the current
CircuitBreaker
-
failurePolicy
- Parameters:
failurePolicy
-- Returns:
- the current
CircuitBreaker
-
reset
- Returns:
- the current
CircuitBreaker
-
open
- Returns:
- the current
CircuitBreaker
-
state
public io.vertx.circuitbreaker.CircuitBreakerState state()- Returns:
- the current state.
-
failureCount
public long failureCount()- Returns:
- the current number of failures.
-
name
- Returns:
- the name of the circuit breaker.
-
retryPolicy
Deprecated.useretryPolicy(RetryPolicy)
instead- Parameters:
retryPolicy
-- Returns:
- the instance of CircuitBreaker to chain method calls.
-
retryPolicy
- Parameters:
retryPolicy
-- Returns:
- the instance of CircuitBreaker to chain method calls.
-
newInstance
-
retryPolicy(RetryPolicy)
instead