Package io.github.resilience4j.retrofit
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);
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classRetrofitCircuitBreaker.CircuitBreakingCall<T> -
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)DecorateCalls allowCircuitBreakerfunctionality.
-
Method Details
-
decorateCall
static <T> retrofit2.Call<T> decorateCall(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker, retrofit2.Call<T> call, java.util.function.Predicate<retrofit2.Response> responseSuccess)DecorateCalls allowCircuitBreakerfunctionality.- Type Parameters:
T- Response type of call- Parameters:
circuitBreaker-CircuitBreakerto applycall- Call to decorateresponseSuccess- determines whether the response should be considered an expected response- Returns:
- Original Call decorated with CircuitBreaker
-