Class FeignDecorators.Builder

  • Enclosing class:
    FeignDecorators

    public static final class FeignDecorators.Builder
    extends java.lang.Object
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • withRetry

        public FeignDecorators.Builder withRetry​(io.github.resilience4j.retry.Retry retry)
        Adds a Retry to the decorator chain.
        Parameters:
        retry - a fully configured Retry.
        Returns:
        the builder
      • withCircuitBreaker

        public FeignDecorators.Builder withCircuitBreaker​(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker)
        Adds a CircuitBreaker to the decorator chain.
        Parameters:
        circuitBreaker - a fully configured CircuitBreaker.
        Returns:
        the builder
      • withRateLimiter

        public FeignDecorators.Builder withRateLimiter​(io.github.resilience4j.ratelimiter.RateLimiter rateLimiter)
        Adds a RateLimiter to the decorator chain.
        Parameters:
        rateLimiter - a fully configured RateLimiter.
        Returns:
        the builder
      • withFallback

        public FeignDecorators.Builder withFallback​(java.lang.Object fallback)
        Adds a fallback to the decorator chain. Multiple fallbacks can be applied with the next fallback being called when the previous one fails.
        Parameters:
        fallback - must match the feign interface, i.e. the interface specified when calling Feign.Builder.target(Class, String).
        Returns:
        the builder
      • withFallbackFactory

        public FeignDecorators.Builder withFallbackFactory​(java.util.function.Function<java.lang.Exception,​?> fallbackFactory)
        Adds a fallback factory to the decorator chain. A factory can consume the exception thrown on error. Multiple fallbacks can be applied with the next fallback being called when the previous one fails.
        Parameters:
        fallbackFactory - must match the feign interface, i.e. the interface specified when calling Feign.Builder.target(Class, String).
        Returns:
        the builder
      • withFallback

        public FeignDecorators.Builder withFallback​(java.lang.Object fallback,
                                                    java.lang.Class<? extends java.lang.Exception> filter)
        Adds a fallback to the decorator chain. Multiple fallbacks can be applied with the next fallback being called when the previous one fails.
        Parameters:
        fallback - must match the feign interface, i.e. the interface specified when calling Feign.Builder.target(Class, String).
        filter - only Exceptions matching the specified Exception will trigger the fallback.
        Returns:
        the builder
      • withFallbackFactory

        public FeignDecorators.Builder withFallbackFactory​(java.util.function.Function<java.lang.Exception,​?> fallbackFactory,
                                                           java.lang.Class<? extends java.lang.Exception> filter)
        Adds a fallback factory to the decorator chain. A factory can consume the exception thrown on error. Multiple fallbacks can be applied with the next fallback being called when the previous one fails.
        Parameters:
        fallbackFactory - must match the feign interface, i.e. the interface specified when calling Feign.Builder.target(Class, String).
        filter - only Exceptions matching the specified Exception will trigger the fallback.
        Returns:
        the builder
      • withFallback

        public FeignDecorators.Builder withFallback​(java.lang.Object fallback,
                                                    java.util.function.Predicate<java.lang.Exception> filter)
        Adds a fallback to the decorator chain. Multiple fallbacks can be applied with the next fallback being called when the previous one fails.
        Parameters:
        fallback - must match the feign interface, i.e. the interface specified when calling Feign.Builder.target(Class, String).
        filter - the filter must return true for the fallback to be called.
        Returns:
        the builder
      • withFallbackFactory

        public FeignDecorators.Builder withFallbackFactory​(java.util.function.Function<java.lang.Exception,​?> fallbackFactory,
                                                           java.util.function.Predicate<java.lang.Exception> filter)
        Adds a fallback to the decorator chain. A factory can consume the exception thrown on error. Multiple fallbacks can be applied with the next fallback being called when the previous one fails.
        Parameters:
        fallbackFactory - must match the feign interface, i.e. the interface specified when calling Feign.Builder.target(Class, String).
        filter - the filter must return true for the fallback to be called.
        Returns:
        the builder
      • withBulkhead

        public FeignDecorators.Builder withBulkhead​(io.github.resilience4j.bulkhead.Bulkhead bulkhead)
        Adds a Bulkhead to the decorator chain.
        Parameters:
        bulkhead - a fully configured Bulkhead.
        Returns:
        the builder