Interface FallbackFactory<T>

Type Parameters:
T - the feign interface type
All Known Implementing Classes:
FallbackFactory.Default

public interface FallbackFactory<T>
Used to control the fallback given its cause. Ex.
 
 // This instance will be invoked if there are errors of any kind.
 FallbackFactory<GitHub> fallbackFactory = cause -> (owner, repo) -> {
   if (cause instanceof FeignException && ((FeignException) cause).status() == 403) {
     return Collections.emptyList();
   } else {
     return Arrays.asList("yogi");
   }
 };

 GitHub github = FeignCircuitBreaker.builder()
                             ...
                             .target(GitHub.class, "https://api.github.com", fallbackFactory);
 
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns an instance of the fallback appropriate for the given cause.
  • Method Details

    • create

      T create(Throwable cause)
      Returns an instance of the fallback appropriate for the given cause.
      Parameters:
      cause - cause of an exception.
      Returns:
      fallback