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 CircuitBreakerCallAdapter of​(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker)
    Create a circuit-breaking call adapter that decorates retrofit calls
    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

    Methods inherited from class retrofit2.CallAdapter.Factory

    getParameterUpperBound, getRawType

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.Factory that can be passed into the Retrofit.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 use
      successResponse - Predicate that determines whether the Call Response should be considered successful
      Returns:
      a CallAdapter.Factory that can be passed into the Retrofit.Builder
    • get

      public retrofit2.CallAdapter<?,​?> get​(java.lang.reflect.Type returnType, java.lang.annotation.Annotation[] annotations, retrofit2.Retrofit retrofit)
      Specified by:
      get in class retrofit2.CallAdapter.Factory