Class WebFluxRequestExecutingMessageHandler
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractMessageProducingHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.http.outbound.AbstractHttpRequestExecutingMessageHandler
org.springframework.integration.webflux.outbound.WebFluxRequestExecutingMessageHandler
- All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>,Aware,BeanClassLoaderAware,BeanFactoryAware,BeanNameAware,DisposableBean,InitializingBean,ApplicationContextAware,Ordered,ExpressionCapable,Orderable,MessageProducer,HeaderPropagationAware,IntegrationPattern,NamedComponent,IntegrationManagement,TrackableComponent,MessageHandler,reactor.core.CoreSubscriber<Message<?>>
public class WebFluxRequestExecutingMessageHandler extends AbstractHttpRequestExecutingMessageHandler
A
MessageHandler implementation that executes
HTTP requests by delegating to a Reactive WebClient instance.- Since:
- 5.0
- Author:
- Shiliang Li, Artem Bilan, Gary Russell, David Graff
- See Also:
HttpRequestExecutingMessageHandler,WebClient
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
AbstractReplyProducingMessageHandler.RequestHandlerNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides -
Field Summary
Fields inherited from class org.springframework.integration.http.outbound.AbstractHttpRequestExecutingMessageHandler
uriFactoryFields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
messagingTemplateFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors Constructor Description 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.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. -
Method Summary
Modifier and Type Method Description protected Objectexchange(Object uri, HttpMethod httpMethod, HttpEntity<?> httpRequest, Object expectedResponseType, Message<?> requestMessage, Map<String,?> uriVariables)StringgetComponentType()Subclasses may implement this method to provide component type information.voidsetBodyExtractor(BodyExtractor<?,ClientHttpResponse> bodyExtractor)Specify aBodyExtractoras an alternative to theexpectedResponseTypeto allow to get low-level access to the receivedClientHttpResponse.voidsetEncodingMode(DefaultUriBuilderFactory.EncodingMode encodingMode)Set the encoding mode to use.voidsetPublisherElementType(Class<?> publisherElementType)Configure a type for a requestPublisherelements.voidsetPublisherElementTypeExpression(Expression publisherElementTypeExpression)Configure a SpEL expression to evaluate a requestPublisherelements type at runtime against a request message.voidsetReplyPayloadToFlux(boolean replyPayloadToFlux)The boolean flag to identify if the reply payload should be as aFluxfrom the response body or as resolved value from theMonoof the response body.Methods inherited from class org.springframework.integration.http.outbound.AbstractHttpRequestExecutingMessageHandler
doInit, evaluateTypeFromExpression, getIntegrationPatternType, getReply, handleRequestMessage, isExpectReply, mapHeaders, setCharset, setExpectedResponseType, setExpectedResponseTypeExpression, setExpectReply, setExtractPayload, setExtractResponseBody, setHeaderMapper, setHttpMethod, setHttpMethodExpression, setTransferCookies, setTrustedSpel, setUriVariableExpressions, setUriVariablesExpressionMethods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
doInvokeAdvisedRequestHandler, getBeanClassLoader, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReplyMethods inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeadersMethods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribeMethods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupport
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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAsMethods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
WebFluxRequestExecutingMessageHandler
Create a handler that will send requests to the provided URI.- Parameters:
uri- The URI.
-
WebFluxRequestExecutingMessageHandler
Create a handler that will send requests to the provided URI.- Parameters:
uri- The URI.
-
WebFluxRequestExecutingMessageHandler
Create a handler that will send requests to the provided URI Expression.- Parameters:
uriExpression- The URI expression.
-
WebFluxRequestExecutingMessageHandler
Create a handler that will send requests to the provided URI using a provided WebClient.- Parameters:
uri- The URI.webClient- The WebClient to use.
-
WebFluxRequestExecutingMessageHandler
public WebFluxRequestExecutingMessageHandler(Expression uriExpression, @Nullable WebClient webClient)Create a handler that will send requests to the provided URI using a provided WebClient.- Parameters:
uriExpression- A SpEL Expression that can be resolved against the message object andBeanFactory.webClient- The WebClient to use.
-
-
Method Details
-
setEncodingMode
Description copied from class:AbstractHttpRequestExecutingMessageHandlerSet the encoding mode to use. By default this is set toDefaultUriBuilderFactory.EncodingMode.TEMPLATE_AND_VALUES. For more complicated scenarios consider to configure anUriTemplateHandleron an externally providedRestTemplate.- Overrides:
setEncodingModein classAbstractHttpRequestExecutingMessageHandler- Parameters:
encodingMode- the mode to use for uri encoding
-
setReplyPayloadToFlux
public void setReplyPayloadToFlux(boolean replyPayloadToFlux)The boolean flag to identify if the reply payload should be as aFluxfrom the response body or as resolved value from theMonoof the response body. Defaults tofalse- simple value is pushed downstream. Makes sense whenexpectedResponseTypeis configured.- Parameters:
replyPayloadToFlux- represent reply payload as aFluxor as a value from theMono.- Since:
- 5.0.1
- See Also:
AbstractHttpRequestExecutingMessageHandler.setExpectedResponseType(Class),AbstractHttpRequestExecutingMessageHandler.setExpectedResponseTypeExpression(Expression)
-
setBodyExtractor
Specify aBodyExtractoras an alternative to theexpectedResponseTypeto allow to get low-level access to the receivedClientHttpResponse.- Parameters:
bodyExtractor- theBodyExtractorto use.- Since:
- 5.0.1
- See Also:
AbstractHttpRequestExecutingMessageHandler.setExpectedResponseType(Class),AbstractHttpRequestExecutingMessageHandler.setExpectedResponseTypeExpression(Expression)
-
setPublisherElementType
Configure a type for a requestPublisherelements.- Parameters:
publisherElementType- the type of the requestPublisherelements.- Since:
- 5.2
- See Also:
BodyInserters.fromPublisher(Publisher, Class)
-
setPublisherElementTypeExpression
Configure a SpEL expression to evaluate a requestPublisherelements type at runtime against a request message.- Parameters:
publisherElementTypeExpression- the expression to evaluate a type for the requestPublisherelements.- Since:
- 5.2
- See Also:
BodyInserters.fromPublisher(Publisher, Class),BodyInserters.fromPublisher(Publisher, ParameterizedTypeReference)
-
getComponentType
Description copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
getComponentTypein interfaceNamedComponent- Overrides:
getComponentTypein classMessageHandlerSupport
-
exchange
@Nullable protected Object exchange(Object uri, HttpMethod httpMethod, HttpEntity<?> httpRequest, Object expectedResponseType, Message<?> requestMessage, Map<String,?> uriVariables)- Specified by:
exchangein classAbstractHttpRequestExecutingMessageHandler
-