Package io.github.resilience4j.feign
Class FeignDecorators.Builder
- java.lang.Object
-
- io.github.resilience4j.feign.FeignDecorators.Builder
-
- Enclosing class:
- FeignDecorators
public static final class FeignDecorators.Builder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FeignDecoratorsbuild()Builds the decorator chain.FeignDecorators.BuilderwithBulkhead(io.github.resilience4j.bulkhead.Bulkhead bulkhead)Adds aBulkheadto the decorator chain.FeignDecorators.BuilderwithCircuitBreaker(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker)Adds aCircuitBreakerto the decorator chain.FeignDecorators.BuilderwithFallback(java.lang.Object fallback)Adds a fallback to the decorator chain.FeignDecorators.BuilderwithFallback(java.lang.Object fallback, java.lang.Class<? extends java.lang.Exception> filter)Adds a fallback to the decorator chain.FeignDecorators.BuilderwithFallback(java.lang.Object fallback, java.util.function.Predicate<java.lang.Exception> filter)Adds a fallback to the decorator chain.FeignDecorators.BuilderwithFallbackFactory(java.util.function.Function<java.lang.Exception,?> fallbackFactory)Adds a fallback factory to the decorator chain.FeignDecorators.BuilderwithFallbackFactory(java.util.function.Function<java.lang.Exception,?> fallbackFactory, java.lang.Class<? extends java.lang.Exception> filter)Adds a fallback factory to the decorator chain.FeignDecorators.BuilderwithFallbackFactory(java.util.function.Function<java.lang.Exception,?> fallbackFactory, java.util.function.Predicate<java.lang.Exception> filter)Adds a fallback to the decorator chain.FeignDecorators.BuilderwithRateLimiter(io.github.resilience4j.ratelimiter.RateLimiter rateLimiter)Adds aRateLimiterto the decorator chain.FeignDecorators.BuilderwithRetry(io.github.resilience4j.retry.Retry retry)Adds aRetryto the decorator chain.
-
-
-
Method Detail
-
withRetry
public FeignDecorators.Builder withRetry(io.github.resilience4j.retry.Retry retry)
Adds aRetryto the decorator chain.- Parameters:
retry- a fully configuredRetry.- Returns:
- the builder
-
withCircuitBreaker
public FeignDecorators.Builder withCircuitBreaker(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker)
Adds aCircuitBreakerto the decorator chain.- Parameters:
circuitBreaker- a fully configuredCircuitBreaker.- Returns:
- the builder
-
withRateLimiter
public FeignDecorators.Builder withRateLimiter(io.github.resilience4j.ratelimiter.RateLimiter rateLimiter)
Adds aRateLimiterto the decorator chain.- Parameters:
rateLimiter- a fully configuredRateLimiter.- 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 callingFeign.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 callingFeign.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 callingFeign.Builder.target(Class, String).filter- onlyExceptions matching the specifiedExceptionwill 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 callingFeign.Builder.target(Class, String).filter- onlyExceptions matching the specifiedExceptionwill 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 callingFeign.Builder.target(Class, String).filter- the filter must returntruefor 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 callingFeign.Builder.target(Class, String).filter- the filter must returntruefor the fallback to be called.- Returns:
- the builder
-
withBulkhead
public FeignDecorators.Builder withBulkhead(io.github.resilience4j.bulkhead.Bulkhead bulkhead)
Adds aBulkheadto the decorator chain.- Parameters:
bulkhead- a fully configuredBulkhead.- Returns:
- the builder
-
build
public FeignDecorators build()
Builds the decorator chain. This can then be used to setup an instance ofResilience4jFeign.- Returns:
- the decorators.
-
-