Package reactivefeign
Class ReactiveFeign.Builder<T>
- java.lang.Object
-
- reactivefeign.ReactiveFeign.Builder<T>
-
- All Implemented Interfaces:
ReactiveFeignBuilder<T>
- Enclosing class:
- ReactiveFeign
public abstract static class ReactiveFeign.Builder<T> extends java.lang.Object implements ReactiveFeignBuilder<T>
ReactiveFeign builder.
-
-
Field Summary
Fields Modifier and Type Field Description protected ReactiveHttpClientFactoryclientFactoryprotected feign.Contractcontractprotected booleandecode404protected java.util.List<ReactiveHttpExchangeFilterFunction>exchangeFilterFunctionsprotected FallbackFactoryfallbackFactoryprotected feign.InvocationHandlerFactoryinvocationHandlerFactoryprotected java.util.List<ReactiveLoggerListener<java.lang.Object>>loggerListenersprotected ReactiveStatusHandlerstatusHandler
-
Constructor Summary
Constructors Modifier Constructor Description protectedBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ReactiveFeignBuilder<T>addExchangeFilterFunction(ReactiveHttpExchangeFilterFunction exchangeFilterFunction)Set exchangeFilterFunction that may modify request before being called and responseReactiveFeign.Builder<T>addLoggerListener(ReactiveLoggerListener loggerListener)May be used to collect request execution metricsReactiveFeign.Builder<T>addRequestInterceptor(ReactiveHttpRequestInterceptor requestInterceptor)Set request interceptor that may modify request before being calledPublisherClientFactorybuildReactiveClientFactory()MethodHandlerFactorybuildReactiveMethodHandlerFactory(PublisherClientFactory reactiveClientFactory)protected ReactiveFeign.Builder<T>clientFactory(ReactiveHttpClientFactory clientFactory)feign.Contractcontract()ReactiveFeign.Builder<T>contract(feign.Contract contract)Sets contract.ReactiveFeign.Builder<T>decode404()This flag indicates that the reactive feign client should process responses with 404 status, specifically returning emptyMonoorFluxinstead of throwingFeignException.ReactiveFeign.Builder<T>fallback(T fallback)ReactiveFeign.Builder<T>fallbackFactory(FallbackFactory<T> fallbackFactory)feign.InvocationHandlerFactoryinvocationHandlerFactory()ReactiveFeign.Builder<T>responseMapper(ReactiveHttpResponseMapper responseMapper)The most common way to introduce custom logic on handling http responsestatic PublisherHttpClientretry(PublisherHttpClient publisherClient, feign.MethodMetadata methodMetadata, java.util.function.Function<reactor.core.publisher.Flux<reactor.util.retry.Retry.RetrySignal>,reactor.core.publisher.Flux<java.lang.Throwable>> retryFunction)ReactiveFeign.Builder<T>retryWhen(ReactiveRetryPolicy retryPolicy)ReactiveFeign.Builder<T>statusHandler(ReactiveStatusHandler statusHandler)Allows to customize response status processingprotected PublisherHttpClienttoPublisher(ReactiveHttpClient reactiveHttpClient, feign.MethodMetadata methodMetadata)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface reactivefeign.ReactiveFeignBuilder
build, objectMapper, options, target, target, target
-
-
-
-
Field Detail
-
contract
protected feign.Contract contract
-
clientFactory
protected ReactiveHttpClientFactory clientFactory
-
exchangeFilterFunctions
protected java.util.List<ReactiveHttpExchangeFilterFunction> exchangeFilterFunctions
-
statusHandler
protected ReactiveStatusHandler statusHandler
-
loggerListeners
protected java.util.List<ReactiveLoggerListener<java.lang.Object>> loggerListeners
-
invocationHandlerFactory
protected feign.InvocationHandlerFactory invocationHandlerFactory
-
decode404
protected boolean decode404
-
fallbackFactory
protected FallbackFactory fallbackFactory
-
-
Method Detail
-
clientFactory
protected ReactiveFeign.Builder<T> clientFactory(ReactiveHttpClientFactory clientFactory)
-
contract
public ReactiveFeign.Builder<T> contract(feign.Contract contract)
Description copied from interface:ReactiveFeignBuilderSets contract. Provided contract will be wrapped inReactiveContract- Specified by:
contractin interfaceReactiveFeignBuilder<T>- Parameters:
contract- contract.- Returns:
- this builder
-
addRequestInterceptor
public ReactiveFeign.Builder<T> addRequestInterceptor(ReactiveHttpRequestInterceptor requestInterceptor)
Description copied from interface:ReactiveFeignBuilderSet request interceptor that may modify request before being called- Specified by:
addRequestInterceptorin interfaceReactiveFeignBuilder<T>- Returns:
-
addLoggerListener
public ReactiveFeign.Builder<T> addLoggerListener(ReactiveLoggerListener loggerListener)
Description copied from interface:ReactiveFeignBuilderMay be used to collect request execution metrics- Specified by:
addLoggerListenerin interfaceReactiveFeignBuilder<T>- Returns:
-
decode404
public ReactiveFeign.Builder<T> decode404()
Description copied from interface:ReactiveFeignBuilderThis flag indicates that the reactive feign client should process responses with 404 status, specifically returning emptyMonoorFluxinstead of throwingFeignException.This flag only works with 404, as opposed to all or arbitrary status codes. This was an explicit decision: 404 - empty is safe, common and doesn't complicate redirection, retry or fallback policy.
- Specified by:
decode404in interfaceReactiveFeignBuilder<T>- Returns:
- this builder
-
addExchangeFilterFunction
public ReactiveFeignBuilder<T> addExchangeFilterFunction(ReactiveHttpExchangeFilterFunction exchangeFilterFunction)
Description copied from interface:ReactiveFeignBuilderSet exchangeFilterFunction that may modify request before being called and response- Specified by:
addExchangeFilterFunctionin interfaceReactiveFeignBuilder<T>- Returns:
-
statusHandler
public ReactiveFeign.Builder<T> statusHandler(ReactiveStatusHandler statusHandler)
Description copied from interface:ReactiveFeignBuilderAllows to customize response status processing- Specified by:
statusHandlerin interfaceReactiveFeignBuilder<T>- Returns:
-
responseMapper
public ReactiveFeign.Builder<T> responseMapper(ReactiveHttpResponseMapper responseMapper)
Description copied from interface:ReactiveFeignBuilderThe most common way to introduce custom logic on handling http response- Specified by:
responseMapperin interfaceReactiveFeignBuilder<T>- Returns:
-
retryWhen
public ReactiveFeign.Builder<T> retryWhen(ReactiveRetryPolicy retryPolicy)
- Specified by:
retryWhenin interfaceReactiveFeignBuilder<T>
-
fallback
public ReactiveFeign.Builder<T> fallback(T fallback)
- Specified by:
fallbackin interfaceReactiveFeignBuilder<T>
-
fallbackFactory
public ReactiveFeign.Builder<T> fallbackFactory(FallbackFactory<T> fallbackFactory)
- Specified by:
fallbackFactoryin interfaceReactiveFeignBuilder<T>
-
contract
public feign.Contract contract()
- Specified by:
contractin interfaceReactiveFeignBuilder<T>
-
invocationHandlerFactory
public feign.InvocationHandlerFactory invocationHandlerFactory()
- Specified by:
invocationHandlerFactoryin interfaceReactiveFeignBuilder<T>
-
buildReactiveClientFactory
public PublisherClientFactory buildReactiveClientFactory()
- Specified by:
buildReactiveClientFactoryin interfaceReactiveFeignBuilder<T>
-
buildReactiveMethodHandlerFactory
public MethodHandlerFactory buildReactiveMethodHandlerFactory(PublisherClientFactory reactiveClientFactory)
- Specified by:
buildReactiveMethodHandlerFactoryin interfaceReactiveFeignBuilder<T>
-
retry
public static PublisherHttpClient retry(PublisherHttpClient publisherClient, feign.MethodMetadata methodMetadata, java.util.function.Function<reactor.core.publisher.Flux<reactor.util.retry.Retry.RetrySignal>,reactor.core.publisher.Flux<java.lang.Throwable>> retryFunction)
-
toPublisher
protected PublisherHttpClient toPublisher(ReactiveHttpClient reactiveHttpClient, feign.MethodMetadata methodMetadata)
-
-