Package io.github.resilience4j.retrofit
Class CircuitBreakerCallAdapter
java.lang.Object
retrofit2.CallAdapter.Factory
io.github.resilience4j.retrofit.CircuitBreakerCallAdapter
public final class CircuitBreakerCallAdapter
extends retrofit2.CallAdapter.Factory
Creates a Retrofit
CallAdapter.Factory that decorates a Call to provide integration with
a CircuitBreaker-
Method Summary
Modifier and Type Method Description retrofit2.CallAdapter<?,?>get(java.lang.reflect.Type returnType, java.lang.annotation.Annotation[] annotations, retrofit2.Retrofit retrofit)static CircuitBreakerCallAdapterof(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker)Create a circuit-breaking call adapter that decorates retrofit callsstatic CircuitBreakerCallAdapterof(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker, java.util.function.Predicate<retrofit2.Response> successResponse)Create a circuit-breaking call adapter that decorates retrofit calls
-
Method Details
-
of
public static CircuitBreakerCallAdapter of(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker)Create a circuit-breaking call adapter that decorates retrofit calls- Parameters:
circuitBreaker- circuit breaker to use- Returns:
- a
CallAdapter.Factorythat can be passed into theRetrofit.Builder
-
of
public static CircuitBreakerCallAdapter of(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker, java.util.function.Predicate<retrofit2.Response> successResponse)Create a circuit-breaking call adapter that decorates retrofit calls- Parameters:
circuitBreaker- circuit breaker to usesuccessResponse-Predicatethat determines whether theCallResponseshould be considered successful- Returns:
- a
CallAdapter.Factorythat can be passed into theRetrofit.Builder
-
get
public retrofit2.CallAdapter<?,?> get(java.lang.reflect.Type returnType, java.lang.annotation.Annotation[] annotations, retrofit2.Retrofit retrofit)- Specified by:
getin classretrofit2.CallAdapter.Factory
-