| Modifier and Type | Field and Description |
|---|---|
static <any> |
__TYPE_ARG |
| Constructor and Description |
|---|
CircuitBreaker(CircuitBreaker delegate) |
public CircuitBreaker(CircuitBreaker delegate)
public CircuitBreaker getDelegate()
public static CircuitBreaker create(String name, Vertx vertx, CircuitBreakerOptions options)
CircuitBreaker.name - the namevertx - the Vert.x instanceoptions - the configuration optionpublic static CircuitBreaker create(String name, Vertx vertx)
CircuitBreaker, with default options.name - the namevertx - the Vert.x instancepublic CircuitBreaker close()
close state of the circuit breaker. To set the circuit breaker in the
close state, use reset().public CircuitBreaker openHandler(Handler<Void> handler)
handler - the handler, must not be nullCircuitBreakerpublic CircuitBreaker halfOpenHandler(Handler<Void> handler)
handler - the handler, must not be nullCircuitBreakerpublic CircuitBreaker closeHandler(Handler<Void> handler)
handler - the handler, must not be nullCircuitBreakerpublic <T> Future<T> executeWithFallback(Handler<Future<T>> command, java.util.function.Function<Throwable,T> fallback)
The operation is not invoked if the circuit breaker is open, and the given fallback is called immediately. The circuit breaker also monitor the completion of the operation before a configure timeout. The operation is considered as failed if it does not terminate in time.
This method returns a object to retrieve the status and result of the operation, with the status being a success or a failure. If the fallback is called, the returned future is successfully completed with the value returned from the fallback. If the fallback throws an exception, the returned future is marked as failed.
command - the operationfallback - the fallback function. It gets an exception as parameter and returns the fallback resultpublic <T> void executeCommandWithFallback(Handler<Future<T>> command, java.util.function.Function<Throwable,T> fallback, Handler<AsyncResult<T>> handler)
executeWithFallback(io.vertx.core.Handler<io.vertx.rxjava.core.Future<T>>, java.util.function.Function<java.lang.Throwable, T>) but using a callback.command - the operationfallback - the fallbackhandler - the completion handler receiving either the operation result or the fallback result. The parameter is an because if the fallback is not called, the error is passed to the handler.public <T> Single<T> rxExecuteCommandWithFallback(Handler<Future<T>> command, java.util.function.Function<Throwable,T> fallback)
executeWithFallback(io.vertx.core.Handler<io.vertx.rxjava.core.Future<T>>, java.util.function.Function<java.lang.Throwable, T>) but using a callback.command - the operationfallback - the fallbackpublic <T> Future<T> execute(Handler<Future<T>> command)
executeWithFallback(io.vertx.core.Handler<io.vertx.rxjava.core.Future<T>>, java.util.function.Function<java.lang.Throwable, T>) but using the circuit breaker default fallback.command - the operationpublic <T> void executeCommand(Handler<Future<T>> command, Handler<AsyncResult<T>> handler)
executeWithFallback(io.vertx.core.Handler<io.vertx.rxjava.core.Future<T>>, java.util.function.Function<java.lang.Throwable, T>) but using the circuit breaker default fallback.command - the operationhandler - public <T> Single<T> rxExecuteCommand(Handler<Future<T>> command)
executeWithFallback(io.vertx.core.Handler<io.vertx.rxjava.core.Future<T>>, java.util.function.Function<java.lang.Throwable, T>) but using the circuit breaker default fallback.command - the operationpublic <T> CircuitBreaker executeAndReport(Future<T> resultFuture, Handler<Future<T>> command)
executeAndReportWithFallback(io.vertx.rxjava.core.Future<T>, io.vertx.core.Handler<io.vertx.rxjava.core.Future<T>>, java.util.function.Function<java.lang.Throwable, T>) but using the circuit breaker default
fallback.resultFuture - the future on which the operation result is reportedcommand - the operationCircuitBreakerpublic <T> CircuitBreaker executeAndReportWithFallback(Future<T> resultFuture, Handler<Future<T>> command, java.util.function.Function<Throwable,T> fallback)
The operation is not invoked if the circuit breaker is open, and the given fallback is called immediately. The circuit breaker also monitor the completion of the operation before a configure timeout. The operation is considered as failed if it does not terminate in time.
Unlike executeWithFallback(io.vertx.core.Handler<io.vertx.rxjava.core.Future<T>>, java.util.function.Function<java.lang.Throwable, T>), this method does return a object, but
let the caller pass a object on which the result is reported. If the fallback is called, the future
is successfully completed with the value returned by the fallback function. If the fallback throws an exception,
the future is marked as failed.
resultFuture - the future on which the operation result is reportedcommand - the operationfallback - the fallback function. It gets an exception as parameter and returns the fallback resultCircuitBreakerpublic <T> CircuitBreaker fallback(java.util.function.Function<Throwable,T> handler)
CircuitBreakerOptions is enabled.
The function gets the exception as parameter and returns the fallback result.
handler - the handlerCircuitBreakerpublic CircuitBreaker reset()
CircuitBreakerpublic CircuitBreaker open()
CircuitBreakerpublic CircuitBreakerState state()
public long failureCount()
public String name()
public CircuitBreaker retryPolicy(java.util.function.Function<Integer,Long> retryPolicy)
public static CircuitBreaker newInstance(CircuitBreaker arg)
Copyright © 2018 Eclipse. All rights reserved.