class CircuitBreaker extends AnyRef
An implementation of the circuit breaker pattern for Vert.x
- Alphabetic
- By Inheritance
- CircuitBreaker
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new CircuitBreaker(_asJava: AnyRef)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asJava: AnyRef
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
close(): CircuitBreaker
Closes the circuit breaker.
Closes the circuit breaker. It stops sending events on its state on the event bus. This method is not related to the
close
state of the circuit breaker. To set the circuit breaker in theclose
state, use io.vertx.scala.circuitbreaker.CircuitBreaker#reset. -
def
closeHandler(handler: Handler[Unit]): CircuitBreaker
Sets a invoked when the circuit breaker state switches to close.
Sets a invoked when the circuit breaker state switches to close. * @param handler the handler, must not be
null
- returns
the current CircuitBreaker
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
execute[T](command: Handler[Future[T]])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Future[T]
Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeWithFallback but using the circuit breaker default fallback.
Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeWithFallback but using the circuit breaker default fallback. * @param command the operation
- returns
a future object completed when the operation or its fallback completes
-
def
executeAndReport[T](resultFuture: Future[T], command: Handler[Future[T]])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): CircuitBreaker
Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeAndReportWithFallback but using the circuit breaker default fallback.
Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeAndReportWithFallback but using the circuit breaker default fallback. * @param resultFuture the future on which the operation result is reported
- command
the operation
- returns
the current CircuitBreaker
-
def
executeAndReportWithFallback[T](resultFuture: Future[T], command: Handler[Future[T]], fallback: (Throwable) ⇒ T)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): CircuitBreaker
Executes the given operation with the circuit breaker control.
Executes the given operation with the circuit breaker control. The operation is generally calling an external system. The operation receives a object as parameter and must call when the operation has terminated successfully. The operation must also call 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 io.vertx.scala.circuitbreaker.CircuitBreaker#executeWithFallback, 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. * @param resultFuture the future on which the operation result is reported
- command
the operation
- fallback
the fallback function. It gets an exception as parameter and returns the fallback result
- returns
the current CircuitBreaker
-
def
executeCommand[T](command: Handler[Future[T]], handler: Handler[AsyncResult[T]])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Unit
Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeWithFallback but using the circuit breaker default fallback.
Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeWithFallback but using the circuit breaker default fallback. * @param command the operation
-
def
executeCommandFuture[T](command: Handler[Future[T]])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Future[T]
Like executeCommand but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
def
executeCommandWithFallback[T](command: Handler[Future[T]], fallback: (Throwable) ⇒ T, handler: Handler[AsyncResult[T]])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Unit
Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeWithFallback but using a callback.
Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeWithFallback but using a callback. * @param command the operation
- fallback
the fallback
- handler
the completion handler receiving either the operation result or the fallback result. The parameter is an io.vertx.lang.scala.AsyncResult because if the fallback is not called, the error is passed to the handler.
-
def
executeCommandWithFallbackFuture[T](command: Handler[Future[T]], fallback: (Throwable) ⇒ T)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Future[T]
Like executeCommandWithFallback but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
def
executeWithFallback[T](command: Handler[Future[T]], fallback: (Throwable) ⇒ T)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Future[T]
Executes the given operation with the circuit breaker control.
Executes the given operation with the circuit breaker control. The operation is generally calling an external system. The operation receives a object as parameter and must call when the operation has terminated successfully. The operation must also call 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 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. * @param command the operation
- fallback
the fallback function. It gets an exception as parameter and returns the fallback result
- returns
a future object completed when the operation or its fallback completes
-
def
failureCount(): Long
- returns
the current number of failures.
-
def
fallback[T](handler: (Throwable) ⇒ T)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): CircuitBreaker
Sets a default invoked when the bridge is open to handle the "request", or on failure if CircuitBreakerOptions is enabled.
Sets a default invoked when the bridge is open to handle the "request", or on failure if CircuitBreakerOptions is enabled.
The function gets the exception as parameter and returns the fallback result. * @param handler the handler
- returns
the current CircuitBreaker
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
halfOpenHandler(handler: Handler[Unit]): CircuitBreaker
Sets a invoked when the circuit breaker state switches to half-open.
Sets a invoked when the circuit breaker state switches to half-open. * @param handler the handler, must not be
null
- returns
the current CircuitBreaker
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
name(): String
- returns
the name of the circuit breaker.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
open(): CircuitBreaker
Explicitly opens the circuit.
Explicitly opens the circuit. * @return the current CircuitBreaker
-
def
openHandler(handler: Handler[Unit]): CircuitBreaker
Sets a invoked when the circuit breaker state switches to open.
Sets a invoked when the circuit breaker state switches to open. * @param handler the handler, must not be
null
- returns
the current CircuitBreaker
-
def
reset(): CircuitBreaker
Resets the circuit breaker state (number of failure set to 0 and state set to closed).
Resets the circuit breaker state (number of failure set to 0 and state set to closed). * @return the current CircuitBreaker
- def retryPolicy(retryPolicy: (Int) ⇒ Long): CircuitBreaker
-
def
state(): CircuitBreakerState
- returns
the current state.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )