Class CircuitBreaker
- java.lang.Object
 - 
- io.vertx.mutiny.circuitbreaker.CircuitBreaker
 
 
- 
public class CircuitBreaker extends Object
An implementation of the circuit breaker pattern for Vert.x NOTE: This class has been automatically generated from theoriginalnon Mutiny-ified interface using Vert.x codegen. 
- 
- 
Field Summary
Fields Modifier and Type Field Description static TypeArg<CircuitBreaker>__TYPE_ARG 
- 
Constructor Summary
Constructors Constructor Description CircuitBreaker(io.vertx.circuitbreaker.CircuitBreaker delegate)CircuitBreaker(Object delegate) 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CircuitBreakerclose()CircuitBreakercloseHandler(Runnable handler)static CircuitBreakercreate(String name, Vertx vertx)static CircuitBreakercreate(String name, Vertx vertx, io.vertx.circuitbreaker.CircuitBreakerOptions options)booleanequals(Object o)<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> TexecuteAndAwait(io.smallrye.mutiny.Uni<T> command)Blocking variant ofio.vertx.mutiny.circuitbreaker.CircuitBreaker#execute(Consumer.>) <T> voidexecuteAndForget(io.smallrye.mutiny.Uni<T> command)Variant ofio.vertx.mutiny.circuitbreaker.CircuitBreaker#execute(Consumerthat ignores the result of the operation.>) <T> CircuitBreakerexecuteAndReport(Promise<T> resultPromise, io.smallrye.mutiny.Uni<T> command)<T> CircuitBreakerexecuteAndReportWithFallback(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> TexecuteWithFallbackAndAwait(io.smallrye.mutiny.Uni<T> command, Function<Throwable,T> fallback)Blocking variant ofio.vertx.mutiny.circuitbreaker.CircuitBreaker#executeWithFallback(Consumer.>,Function ) <T> voidexecuteWithFallbackAndForget(io.smallrye.mutiny.Uni<T> command, Function<Throwable,T> fallback)Variant ofio.vertx.mutiny.circuitbreaker.CircuitBreaker#executeWithFallback(Consumerthat ignores the result of the operation.>,Function ) longfailureCount()<T> CircuitBreakerfallback(Function<Throwable,T> handler)io.vertx.circuitbreaker.CircuitBreakergetDelegate()CircuitBreakerhalfOpenHandler(Runnable handler)inthashCode()Stringname()static CircuitBreakernewInstance(io.vertx.circuitbreaker.CircuitBreaker arg)CircuitBreakeropen()CircuitBreakeropenHandler(Runnable handler)CircuitBreakerreset()CircuitBreakerretryPolicy(Function<Integer,Long> retryPolicy)io.vertx.circuitbreaker.CircuitBreakerStatestate()StringtoString() 
 - 
 
- 
- 
Field Detail
- 
__TYPE_ARG
public static final TypeArg<CircuitBreaker> __TYPE_ARG
 
 - 
 
- 
Constructor Detail
- 
CircuitBreaker
public CircuitBreaker(io.vertx.circuitbreaker.CircuitBreaker delegate)
 
- 
CircuitBreaker
public CircuitBreaker(Object delegate)
 
 - 
 
- 
Method Detail
- 
getDelegate
public io.vertx.circuitbreaker.CircuitBreaker getDelegate()
 
- 
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
public static CircuitBreaker create(String name, Vertx vertx)
- Parameters:
 name- the namevertx- the Vert.x instance- Returns:
 - the created instance
 
 
- 
close
public CircuitBreaker close()
- Returns:
 - the instance of CircuitBreaker to chain method calls.
 
 
- 
openHandler
public CircuitBreaker openHandler(Runnable handler)
- Parameters:
 handler- the handler, must not benull- Returns:
 
 
- 
halfOpenHandler
public CircuitBreaker halfOpenHandler(Runnable handler)
- Parameters:
 handler- the handler, must not benull- Returns:
 
 
- 
closeHandler
public CircuitBreaker closeHandler(Runnable handler)
- Parameters:
 handler- the handler, must not benull- Returns:
 
 
- 
executeWithFallback
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 
unifiring 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 ofio.vertx.mutiny.circuitbreaker.CircuitBreaker#executeWithFallback(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 ofio.vertx.mutiny.circuitbreaker.CircuitBreaker#executeWithFallback(Consumerthat ignores the result of the operation.>,Function ) This method subscribes on the result of
io.vertx.mutiny.circuitbreaker.CircuitBreaker#executeWithFallback(Consumer, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from>,Function ) io.vertx.mutiny.circuitbreaker.CircuitBreaker#executeWithFallback(Consumerbut you don't need to compose it with other operations.>,Function ) - Parameters:
 command- the operationfallback- the fallback
 
- 
execute
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 
unifiring 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 ofio.vertx.mutiny.circuitbreaker.CircuitBreaker#execute(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 ofio.vertx.mutiny.circuitbreaker.CircuitBreaker#execute(Consumerthat ignores the result of the operation.>) This method subscribes on the result of
io.vertx.mutiny.circuitbreaker.CircuitBreaker#execute(Consumer, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from>) io.vertx.mutiny.circuitbreaker.CircuitBreaker#execute(Consumerbut 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
public <T> CircuitBreaker fallback(Function<Throwable,T> handler)
- Parameters:
 handler- the handler- Returns:
 - the current 
CircuitBreaker 
 
- 
reset
public CircuitBreaker reset()
- Returns:
 - the current 
CircuitBreaker 
 
- 
open
public 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
public String name()
- Returns:
 - the name of the circuit breaker.
 
 
- 
retryPolicy
public CircuitBreaker retryPolicy(Function<Integer,Long> retryPolicy)
 
- 
newInstance
public static CircuitBreaker newInstance(io.vertx.circuitbreaker.CircuitBreaker arg)
 
 - 
 
 -