Interface CircuitBreaker

All Known Implementing Classes:
NoopCircuitBreaker

public interface CircuitBreaker
The CircuitBreaker interface defines the external integration points between an implementation and its calling BaseEndpoint.

See the individual implementation for details on how they work. Note that they are all configured through the CircuitBreakerConfig that is configured on the environment on a per service basis and applied on a per endpoint basis.

Since:
2.0.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type Interface Description
    static interface  CircuitBreaker.CompletionCallback
    Defines if a request is considered a success or a failure.
    static class  CircuitBreaker.State
    Represents all the states a circuit breaker can be in, possibly.
  • Method Summary

    Modifier and Type Method Description
    boolean allowsRequest()
    Returns true if requests are allowed to go through and be tracked.
    void markFailure()
    The tracked request is marked failure.
    void markSuccess()
    The tracked request is marked succeeded.
    void reset()
    Resets this circuit breaker to its initial state.
    CircuitBreaker.State state()
    Returns the current state of the circuit breaker.
    void track()
    Marks that a circuit breaker should start tracking.
  • Method Details

    • track

      void track()
      Marks that a circuit breaker should start tracking.
    • markSuccess

      void markSuccess()
      The tracked request is marked succeeded.
    • markFailure

      void markFailure()
      The tracked request is marked failure.
    • reset

      void reset()
      Resets this circuit breaker to its initial state.
    • allowsRequest

      boolean allowsRequest()
      Returns true if requests are allowed to go through and be tracked.
    • state

      Returns the current state of the circuit breaker.