Package io.github.resilience4j.feign
Class FeignDecorators.Builder
java.lang.Object
io.github.resilience4j.feign.FeignDecorators.Builder
- Enclosing class:
- FeignDecorators
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the decorator chain.withBulkhead(io.github.resilience4j.bulkhead.Bulkhead bulkhead) Adds aBulkheadto the decorator chain.withCircuitBreaker(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker) Adds aCircuitBreakerto the decorator chain.withFallback(Object fallback) Adds a fallback to the decorator chain.withFallback(Object fallback, Class<? extends Exception> filter) Adds a fallback to the decorator chain.withFallback(Object fallback, Predicate<Exception> filter) Adds a fallback to the decorator chain.withFallbackFactory(Function<Exception, ?> fallbackFactory) Adds a fallback factory to the decorator chain.withFallbackFactory(Function<Exception, ?> fallbackFactory, Class<? extends Exception> filter) Adds a fallback factory to the decorator chain.withFallbackFactory(Function<Exception, ?> fallbackFactory, Predicate<Exception> filter) Adds a fallback to the decorator chain.withRateLimiter(io.github.resilience4j.ratelimiter.RateLimiter rateLimiter) Adds aRateLimiterto the decorator chain.withRetry(io.github.resilience4j.retry.Retry retry) Adds aRetryto the decorator chain.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
withRetry
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
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
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
Adds a fallback to the decorator chain. Multiple fallbacks can be applied with the next fallback being called when the previous one fails. -
withFallbackFactory
public FeignDecorators.Builder withFallbackFactory(Function<Exception, ?> fallbackFactory, Class<? extends 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. -
withFallback
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(Function<Exception, ?> fallbackFactory, Predicate<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
Adds aBulkheadto the decorator chain.- Parameters:
bulkhead- a fully configuredBulkhead.- Returns:
- the builder
-
build
Builds the decorator chain. This can then be used to setup an instance ofResilience4jFeign.- Returns:
- the decorators.
-