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, Jatin Saxena
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandlerAbstractReplyProducingMessageHandler.RequestHandlerNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFields inherited from class org.springframework.integration.http.outbound.AbstractHttpRequestExecutingMessageHandleruriFactoryFields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandlermessagingTemplateFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagementMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.core.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructorsConstructorDescriptionCreate 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.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 SummaryModifier and TypeMethodDescriptionprotected final voiddoInit()protected Objectexchange(Object uri, HttpMethod httpMethod, HttpEntity<?> httpRequest, Object expectedResponseType, Message<?> requestMessage, Map<String, ?> uriVariables) Subclasses may implement this method to provide component type information.voidsetAttributeVariablesExpression(Expression attributeVariablesExpression) Configure expression to evaluate request attribute which will be added to webclient request attribute.voidsetBodyExtractor(BodyExtractor<?, ? super 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.AbstractHttpRequestExecutingMessageHandlerevaluateTypeFromExpression, 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.AbstractReplyProducingMessageHandlerdoInvokeAdvisedRequestHandler, getBeanClassLoader, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReplyMethods inherited from class org.springframework.integration.handler.AbstractMessageProducingHandleraddNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, setupMessageProcessor, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeadersMethods inherited from class org.springframework.integration.handler.AbstractMessageHandlerhandleMessage, onComplete, onError, onNext, onSubscribe, setObservationConventionMethods inherited from class org.springframework.integration.handler.MessageHandlerSupportbuildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface reactor.core.CoreSubscribercurrentContextMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetThisAsMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Constructor Details- 
WebFluxRequestExecutingMessageHandlerCreate a handler that will send requests to the provided URI.- Parameters:
- uri- The URI.
 
- 
WebFluxRequestExecutingMessageHandlerCreate a handler that will send requests to the provided URI.- Parameters:
- uri- The URI.
 
- 
WebFluxRequestExecutingMessageHandlerCreate a handler that will send requests to the provided URI Expression.- Parameters:
- uriExpression- The URI expression.
 
- 
WebFluxRequestExecutingMessageHandlerCreate a handler that will send requests to the provided URI using a provided WebClient.- Parameters:
- uri- The URI.
- webClient- The WebClient to use.
 
- 
WebFluxRequestExecutingMessageHandlerpublic 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 and- BeanFactory.
- webClient- The WebClient to use.
 
 
- 
- 
Method Details- 
setEncodingModeDescription copied from class:AbstractHttpRequestExecutingMessageHandlerSet the encoding mode to use. By default, this is set toDefaultUriBuilderFactory.EncodingMode.TEMPLATE_AND_VALUES. For more complicated scenarios consider configuring anUriTemplateHandleron an externally providedRestTemplate.- Overrides:
- setEncodingModein class- AbstractHttpRequestExecutingMessageHandler
- Parameters:
- encodingMode- the mode to use for uri encoding
 
- 
setReplyPayloadToFluxpublic 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 a- Fluxor as a value from the- Mono.
- Since:
- 5.0.1
- See Also:
 
- 
setBodyExtractorSpecify aBodyExtractoras an alternative to theexpectedResponseTypeto allow to get low-level access to the receivedClientHttpResponse.- Parameters:
- bodyExtractor- the- BodyExtractorto use.
- Since:
- 5.0.1
- See Also:
 
- 
setPublisherElementTypeConfigure a type for a requestPublisherelements.- Parameters:
- publisherElementType- the type of the request- Publisherelements.
- Since:
- 5.2
- See Also:
 
- 
setPublisherElementTypeExpressionConfigure a SpEL expression to evaluate a requestPublisherelements type at runtime against a request message.- Parameters:
- publisherElementTypeExpression- the expression to evaluate a type for the request- Publisherelements.
- Since:
- 5.2
- See Also:
 
- 
setAttributeVariablesExpressionConfigure expression to evaluate request attribute which will be added to webclient request attribute.- Parameters:
- attributeVariablesExpression- the expression to evaluate request attribute.
- Since:
- 6.0
- See Also:
 
- 
getComponentTypeDescription copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
- getComponentTypein interface- NamedComponent
- Overrides:
- getComponentTypein class- MessageHandlerSupport
 
- 
doInitprotected final void doInit()- Overrides:
- doInitin class- AbstractHttpRequestExecutingMessageHandler
 
- 
exchange@Nullable protected Object exchange(Object uri, HttpMethod httpMethod, HttpEntity<?> httpRequest, Object expectedResponseType, Message<?> requestMessage, Map<String, ?> uriVariables) - Specified by:
- exchangein class- AbstractHttpRequestExecutingMessageHandler
 
 
-