Interface RetrofitCircuitBreaker


  • public interface RetrofitCircuitBreaker
    Decorates a Retrofit Call to inform a CircuitBreaker when an exception is thrown. All exceptions are marked as errors or responses not matching the supplied predicate. For example:

    RetrofitCircuitBreaker.decorateCall(circuitBreaker, call, Response::isSuccessful);

    • Method Summary

      Static Methods 
      Modifier and Type Method Description
      static <T> retrofit2.Call<T> decorateCall​(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker, retrofit2.Call<T> call, java.util.function.Predicate<retrofit2.Response> responseSuccess)
      Decorate Calls allow CircuitBreaker functionality.
    • Method Detail

      • decorateCall

        static <T> retrofit2.Call<T> decorateCall​(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker,
                                                  retrofit2.Call<T> call,
                                                  java.util.function.Predicate<retrofit2.Response> responseSuccess)
        Decorate Calls allow CircuitBreaker functionality.
        Type Parameters:
        T - Response type of call
        Parameters:
        circuitBreaker - CircuitBreaker to apply
        call - Call to decorate
        responseSuccess - determines whether the response should be considered an expected response
        Returns:
        Original Call decorated with CircuitBreaker