public class WebFluxRequestExecutingMessageHandler extends AbstractHttpRequestExecutingMessageHandler
MessageHandler
implementation that executes
HTTP requests by delegating to a Reactive WebClient
instance.HttpRequestExecutingMessageHandler
,
WebClient
AbstractReplyProducingMessageHandler.RequestHandler
IntegrationManagement.ManagementOverrides
uriFactory
messagingTemplate
EXPRESSION_PARSER, logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
WebFluxRequestExecutingMessageHandler(Expression uriExpression)
Create a handler that will send requests to the provided URI Expression.
|
WebFluxRequestExecutingMessageHandler(Expression uriExpression,
WebClient webClient)
Create a handler that will send requests to the provided URI using a provided WebClient.
|
WebFluxRequestExecutingMessageHandler(String uri)
Create a handler that will send requests to the provided URI.
|
WebFluxRequestExecutingMessageHandler(String uri,
WebClient webClient)
Create a handler that will send requests to the provided URI using a provided WebClient.
|
WebFluxRequestExecutingMessageHandler(URI uri)
Create a handler that will send requests to the provided URI.
|
Modifier and Type | Method and Description |
---|---|
protected Object |
exchange(Object uri,
HttpMethod httpMethod,
HttpEntity<?> httpRequest,
Object expectedResponseType,
Message<?> requestMessage,
Map<String,?> uriVariables) |
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
void |
setBodyExtractor(BodyExtractor<?,ClientHttpResponse> bodyExtractor)
Specify a
BodyExtractor as an alternative to the expectedResponseType
to allow to get low-level access to the received ClientHttpResponse . |
void |
setEncodingMode(DefaultUriBuilderFactory.EncodingMode encodingMode)
Set the encoding mode to use.
|
void |
setPublisherElementType(Class<?> publisherElementType)
Configure a type for a request
Publisher elements. |
void |
setPublisherElementTypeExpression(Expression publisherElementTypeExpression)
Configure a SpEL expression to evaluate a request
Publisher elements type at runtime against
a request message. |
void |
setReplyPayloadToFlux(boolean replyPayloadToFlux)
The boolean flag to identify if the reply payload should be as a
Flux from the response body
or as resolved value from the Mono of the response body. |
doInit, evaluateTypeFromExpression, getIntegrationPatternType, getReply, handleRequestMessage, isExpectReply, mapHeaders, setCharset, setEncodeUri, setExpectedResponseType, setExpectedResponseTypeExpression, setExpectReply, setExtractPayload, setHeaderMapper, setHttpMethod, setHttpMethodExpression, setTransferCookies, setTrustedSpel, setUriVariableExpressions, setUriVariablesExpression
doInvokeAdvisedRequestHandler, getBeanClassLoader, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReply
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeaders
handleMessage, onComplete, onError, onNext, onSubscribe
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getThisAs
getBeanName, getComponentName
public WebFluxRequestExecutingMessageHandler(URI uri)
uri
- The URI.public WebFluxRequestExecutingMessageHandler(String uri)
uri
- The URI.public WebFluxRequestExecutingMessageHandler(Expression uriExpression)
uriExpression
- The URI expression.public WebFluxRequestExecutingMessageHandler(String uri, @Nullable WebClient webClient)
uri
- The URI.webClient
- The WebClient to use.public WebFluxRequestExecutingMessageHandler(Expression uriExpression, @Nullable WebClient webClient)
uriExpression
- A SpEL Expression that can be resolved against the message object and
BeanFactory
.webClient
- The WebClient to use.public void setEncodingMode(DefaultUriBuilderFactory.EncodingMode encodingMode)
AbstractHttpRequestExecutingMessageHandler
DefaultUriBuilderFactory.EncodingMode#TEMPLATE_AND_VALUES
.
For more complicated scenarios consider to configure an UriTemplateHandler
on an externally provided RestTemplate
.setEncodingMode
in class AbstractHttpRequestExecutingMessageHandler
encodingMode
- the mode to use for uri encodingpublic void setReplyPayloadToFlux(boolean replyPayloadToFlux)
Flux
from the response body
or as resolved value from the Mono
of the response body.
Defaults to false
- simple value is pushed downstream.
Makes sense when expectedResponseType
is configured.replyPayloadToFlux
- represent reply payload as a Flux
or as a value from the Mono
.AbstractHttpRequestExecutingMessageHandler.setExpectedResponseType(Class)
,
AbstractHttpRequestExecutingMessageHandler.setExpectedResponseTypeExpression(Expression)
public void setBodyExtractor(BodyExtractor<?,ClientHttpResponse> bodyExtractor)
BodyExtractor
as an alternative to the expectedResponseType
to allow to get low-level access to the received ClientHttpResponse
.bodyExtractor
- the BodyExtractor
to use.AbstractHttpRequestExecutingMessageHandler.setExpectedResponseType(Class)
,
AbstractHttpRequestExecutingMessageHandler.setExpectedResponseTypeExpression(Expression)
public void setPublisherElementType(Class<?> publisherElementType)
Publisher
elements.publisherElementType
- the type of the request Publisher
elements.BodyInserters.fromPublisher(Publisher, Class)
public void setPublisherElementTypeExpression(Expression publisherElementTypeExpression)
Publisher
elements type at runtime against
a request message.publisherElementTypeExpression
- the expression to evaluate a type for the request
Publisher
elements.BodyInserters.fromPublisher(Publisher, Class)
,
BodyInserters.fromPublisher(Publisher, ParameterizedTypeReference)
public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class MessageHandlerSupport
@Nullable protected Object exchange(Object uri, HttpMethod httpMethod, HttpEntity<?> httpRequest, Object expectedResponseType, Message<?> requestMessage, Map<String,?> uriVariables)
exchange
in class AbstractHttpRequestExecutingMessageHandler