Class CircuitBreakerBuilder

java.lang.Object
io.vertx.mutiny.circuitbreaker.CircuitBreakerBuilder
All Implemented Interfaces:
MutinyDelegate

public class CircuitBreakerBuilder extends Object implements MutinyDelegate
A builder for CircuitBreaker.

Unlike CircuitBreaker#openHandler(Handler), CircuitBreaker#halfOpenHandler(Handler) and CircuitBreaker#closeHandler(Handler), the handlers configured through this builder are baked in as immutable when build() is called: calling the corresponding mutator method again on the built circuit breaker throws an IllegalStateException.

NOTE: This class has been automatically generated from the original non Mutiny-ified interface.

See Also:
  • CircuitBreakerBuilder
  • Field Details

  • Constructor Details

    • CircuitBreakerBuilder

      public CircuitBreakerBuilder(io.vertx.circuitbreaker.CircuitBreakerBuilder delegate)
      Create a new instance of CircuitBreakerBuilder delegating to the given (non-null) instance of CircuitBreakerBuilder.
    • CircuitBreakerBuilder

      public CircuitBreakerBuilder(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.circuitbreaker.CircuitBreakerBuilder getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate instance
    • with

      public CircuitBreakerBuilder with(io.vertx.circuitbreaker.CircuitBreakerOptions options)
      Configure the circuit breaker options.
      Parameters:
      options - the configuration options
      Returns:
      a reference to this, so the API can be used fluently
    • openHandler

      public CircuitBreakerBuilder openHandler(Runnable handler)
      Set the handler invoked when the circuit breaker state switches to open.
      Parameters:
      handler - the handler
      Returns:
      a reference to this, so the API can be used fluently
    • halfOpenHandler

      public CircuitBreakerBuilder halfOpenHandler(Runnable handler)
      Set the handler invoked when the circuit breaker state switches to half-open.
      Parameters:
      handler - the handler
      Returns:
      a reference to this, so the API can be used fluently
    • closeHandler

      public CircuitBreakerBuilder closeHandler(Runnable handler)
      Set the handler invoked when the circuit breaker state switches to closed.
      Parameters:
      handler - the handler
      Returns:
      a reference to this, so the API can be used fluently
    • fallback

      public <T> CircuitBreakerBuilder fallback(Function<Throwable,T> handler)
      Set the default fallback function, see CircuitBreaker.fallback(Function).
      Parameters:
      handler - the fallback function
      Returns:
      a reference to this, so the API can be used fluently
    • failurePolicy

      public <T> CircuitBreakerBuilder failurePolicy(FailurePolicy<T> failurePolicy)
      Set the failure policy, see CircuitBreaker.failurePolicy(FailurePolicy).
      Parameters:
      failurePolicy - the failure policy
      Returns:
      a reference to this, so the API can be used fluently
    • retryPolicy

      public CircuitBreakerBuilder retryPolicy(RetryPolicy retryPolicy)
      Set the retry policy, see CircuitBreaker.retryPolicy(RetryPolicy).
      Parameters:
      retryPolicy - the retry policy
      Returns:
      a reference to this, so the API can be used fluently
    • build

      public CircuitBreaker build()
      Build and return the circuit breaker.
      Returns:
      the circuit breaker as configured by this builder
    • newInstance

      public static CircuitBreakerBuilder newInstance(io.vertx.circuitbreaker.CircuitBreakerBuilder delegate)
      Creates a new instance of the CircuitBreakerBuilder.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object