public interface CircuitBreaker
| Modifier and Type | Method and Description | 
|---|---|
CircuitBreaker | 
close()
Closes the circuit breaker. 
 | 
CircuitBreaker | 
closeHandler(Handler<Void> handler)
Sets a  
Handler invoked when the circuit breaker state switches to close. | 
static CircuitBreaker | 
create(String name,
      Vertx vertx)
Creates a new instance of  
CircuitBreaker, with default options. | 
static CircuitBreaker | 
create(String name,
      Vertx vertx,
      CircuitBreakerOptions options)
Creates a new instance of  
CircuitBreaker. | 
<T> Future<T> | 
execute(Handler<Promise<T>> command)
Same as  
executeWithFallback(Handler, Function) but using the circuit breaker default fallback. | 
default <T> void | 
execute(Handler<Promise<T>> command,
       Handler<AsyncResult<T>> handler)
Same as  
executeWithFallback(Handler, Function) but using the circuit breaker default fallback. | 
default <T> CircuitBreaker | 
executeAndReport(Future<T> resultFuture,
                Handler<Promise<T>> command)
Deprecated. 
 
use  
executeAndReport(Promise, Handler) instead | 
<T> CircuitBreaker | 
executeAndReport(Promise<T> resultPromise,
                Handler<Promise<T>> command)
Same as  
executeAndReportWithFallback(Promise, Handler, Function) but using the circuit breaker default
 fallback. | 
default <T> CircuitBreaker | 
executeAndReportWithFallback(Future<T> resultFuture,
                            Handler<Promise<T>> command,
                            java.util.function.Function<Throwable,T> fallback)
Deprecated. 
 
 | 
<T> CircuitBreaker | 
executeAndReportWithFallback(Promise<T> resultPromise,
                            Handler<Promise<T>> command,
                            java.util.function.Function<Throwable,T> fallback)
Executes the given operation with the circuit breaker control. 
 | 
default <T> void | 
executeCommand(Handler<Promise<T>> command,
              Handler<AsyncResult<T>> handler)
Deprecated. 
 
instead use  
execute(Handler, Handler) | 
default <T> void | 
executeCommandWithFallback(Handler<Promise<T>> command,
                          java.util.function.Function<Throwable,T> fallback,
                          Handler<AsyncResult<T>> handler)
Deprecated. 
 
instead use  
executeWithFallback(Handler, Function, Handler) | 
<T> Future<T> | 
executeWithFallback(Handler<Promise<T>> command,
                   java.util.function.Function<Throwable,T> fallback)
Executes the given operation with the circuit breaker control. 
 | 
default <T> void | 
executeWithFallback(Handler<Promise<T>> command,
                   java.util.function.Function<Throwable,T> fallback,
                   Handler<AsyncResult<T>> handler)
Same as  
executeWithFallback(Handler, Function) but using a callback. | 
long | 
failureCount()  | 
<T> CircuitBreaker | 
fallback(java.util.function.Function<Throwable,T> handler)
Sets a default  
Function invoked when the bridge is open to handle the "request", or on failure
 if CircuitBreakerOptions.isFallbackOnFailure() is enabled. | 
CircuitBreaker | 
halfOpenHandler(Handler<Void> handler)
Sets a  
Handler invoked when the circuit breaker state switches to half-open. | 
String | 
name()  | 
CircuitBreaker | 
open()
Explicitly opens the circuit. 
 | 
CircuitBreaker | 
openHandler(Handler<Void> handler)
Sets a  
Handler invoked when the circuit breaker state switches to open. | 
CircuitBreaker | 
reset()
Resets the circuit breaker state (number of failure set to 0 and state set to closed). 
 | 
CircuitBreaker | 
retryPolicy(java.util.function.Function<Integer,Long> retryPolicy)  | 
CircuitBreakerState | 
state()  | 
static CircuitBreaker create(String name, Vertx vertx, CircuitBreakerOptions options)
CircuitBreaker.name - the namevertx - the Vert.x instanceoptions - the configuration optionstatic CircuitBreaker create(String name, Vertx vertx)
CircuitBreaker, with default options.name - the namevertx - the Vert.x instanceCircuitBreaker close()
close state of the circuit breaker. To set the circuit breaker in the
 close state, use reset().CircuitBreaker openHandler(Handler<Void> handler)
Handler invoked when the circuit breaker state switches to open.handler - the handler, must not be nullCircuitBreakerCircuitBreaker halfOpenHandler(Handler<Void> handler)
Handler invoked when the circuit breaker state switches to half-open.handler - the handler, must not be nullCircuitBreakerCircuitBreaker closeHandler(Handler<Void> handler)
Handler invoked when the circuit breaker state switches to close.handler - the handler, must not be nullCircuitBreaker<T> Future<T> executeWithFallback(Handler<Promise<T>> command, java.util.function.Function<Throwable,T> fallback)
Promise object as parameter and must
 call Promise.complete(Object) when the operation has terminated successfully. The operation must also
 call Promise.fail(Throwable) in case of failure.
 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 Future 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.
T - the type of resultcommand - the operationfallback - the fallback function. It gets an exception as parameter and returns the fallback resultdefault <T> void executeWithFallback(Handler<Promise<T>> command, java.util.function.Function<Throwable,T> fallback, Handler<AsyncResult<T>> handler)
executeWithFallback(Handler, Function) but using a callback.T - the type of resultcommand - the operationfallback - the fallbackhandler - the completion handler receiving either the operation result or the fallback result. The
                 parameter is an AsyncResult because if the fallback is not called, the error is passed
                 to the handler.@Deprecated default <T> void executeCommandWithFallback(Handler<Promise<T>> command, java.util.function.Function<Throwable,T> fallback, Handler<AsyncResult<T>> handler)
executeWithFallback(Handler, Function, Handler)executeWithFallback(Handler, Function) but using a callback.T - the type of resultcommand - the operationfallback - the fallbackhandler - the completion handler receiving either the operation result or the fallback result. The
                 parameter is an AsyncResult because if the fallback is not called, the error is passed
                 to the handler.<T> Future<T> execute(Handler<Promise<T>> command)
executeWithFallback(Handler, Function) but using the circuit breaker default fallback.T - the type of resultcommand - the operationdefault <T> void execute(Handler<Promise<T>> command, Handler<AsyncResult<T>> handler)
executeWithFallback(Handler, Function) but using the circuit breaker default fallback.T - the type of resultcommand - the operationhandler - the completion handler receiving either the operation result or the fallback result. The
                 parameter is an AsyncResult because if the fallback is not called, the error is passed
                 to the handler.@Deprecated default <T> void executeCommand(Handler<Promise<T>> command, Handler<AsyncResult<T>> handler)
execute(Handler, Handler)executeWithFallback(Handler, Function) but using the circuit breaker default fallback.T - the type of resultcommand - the operationhandler - the completion handler receiving either the operation result or the fallback result. The
                 parameter is an AsyncResult because if the fallback is not called, the error is passed
                 to the handler.<T> CircuitBreaker executeAndReport(Promise<T> resultPromise, Handler<Promise<T>> command)
executeAndReportWithFallback(Promise, Handler, Function) but using the circuit breaker default
 fallback.T - the type of resultresultPromise - the promise on which the operation result is reportedcommand - the operationCircuitBreaker@Deprecated default <T> CircuitBreaker executeAndReport(Future<T> resultFuture, Handler<Promise<T>> command)
executeAndReport(Promise, Handler) instead<T> CircuitBreaker executeAndReportWithFallback(Promise<T> resultPromise, Handler<Promise<T>> command, java.util.function.Function<Throwable,T> fallback)
Promise object as parameter and must
 call Promise.complete(Object) when the operation has terminated successfully. The operation must also
 call Promise.fail(Throwable) in case of failure.
 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(Handler, Function),  this method does return a Future object, but
 let the caller pass a Promise object on which the result is reported. If the fallback is called, the promise
 is successfully completed with the value returned by the fallback function. If the fallback throws an exception,
 the promise is marked as failed.
T - the type of resultresultPromise - the promise on which the operation result is reportedcommand - the operationfallback - the fallback function. It gets an exception as parameter and returns the fallback resultCircuitBreaker@Deprecated default <T> CircuitBreaker executeAndReportWithFallback(Future<T> resultFuture, Handler<Promise<T>> command, java.util.function.Function<Throwable,T> fallback)
executeAndReportWithFallback(Promise, Handler, Function) instead<T> CircuitBreaker fallback(java.util.function.Function<Throwable,T> handler)
Function invoked when the bridge is open to handle the "request", or on failure
 if CircuitBreakerOptions.isFallbackOnFailure() is enabled.
 The function gets the exception as parameter and returns the fallback result.
handler - the handlerCircuitBreakerCircuitBreaker reset()
CircuitBreakerCircuitBreaker open()
CircuitBreakerCircuitBreakerState state()
long failureCount()
String name()
CircuitBreaker retryPolicy(java.util.function.Function<Integer,Long> retryPolicy)
Copyright © 2020 Eclipse. All rights reserved.