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<org.springframework.messaging.Message<?>>, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.core.Ordered, org.springframework.integration.context.ExpressionCapable, org.springframework.integration.context.Orderable, org.springframework.integration.core.MessageProducer, org.springframework.integration.handler.HeaderPropagationAware, org.springframework.integration.IntegrationPattern, org.springframework.integration.support.context.NamedComponent, org.springframework.integration.support.management.IntegrationManagement, org.springframework.integration.support.management.TrackableComponent, org.springframework.messaging.MessageHandler, reactor.core.CoreSubscriber<org.springframework.messaging.Message<?>>

public class WebFluxRequestExecutingMessageHandler
extends org.springframework.integration.http.outbound.AbstractHttpRequestExecutingMessageHandler
A MessageHandler implementation that executes HTTP requests by delegating to a Reactive WebClient instance.
Since:
5.0
See Also:
HttpRequestExecutingMessageHandler, WebClient
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler

    org.springframework.integration.handler.AbstractReplyProducingMessageHandler.RequestHandler

    Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement

    org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides
  • Field Summary

    Fields inherited from class org.springframework.integration.http.outbound.AbstractHttpRequestExecutingMessageHandler

    uriFactory

    Fields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler

    messagingTemplate

    Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport

    EXPRESSION_PARSER, logger

    Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement

    METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors 
    Constructor Description
    WebFluxRequestExecutingMessageHandler​(java.lang.String uri)
    Create a handler that will send requests to the provided URI.
    WebFluxRequestExecutingMessageHandler​(java.lang.String uri, org.springframework.web.reactive.function.client.WebClient webClient)
    Create a handler that will send requests to the provided URI using a provided WebClient.
    WebFluxRequestExecutingMessageHandler​(java.net.URI uri)
    Create a handler that will send requests to the provided URI.
    WebFluxRequestExecutingMessageHandler​(org.springframework.expression.Expression uriExpression)
    Create a handler that will send requests to the provided URI Expression.
    WebFluxRequestExecutingMessageHandler​(org.springframework.expression.Expression uriExpression, org.springframework.web.reactive.function.client.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 java.lang.Object exchange​(java.lang.Object uri, org.springframework.http.HttpMethod httpMethod, org.springframework.http.HttpEntity<?> httpRequest, java.lang.Object expectedResponseType, org.springframework.messaging.Message<?> requestMessage, java.util.Map<java.lang.String,​?> uriVariables)  
    java.lang.String getComponentType()  
    void setBodyExtractor​(org.springframework.web.reactive.function.BodyExtractor<?,​org.springframework.http.client.reactive.ClientHttpResponse> bodyExtractor)
    Specify a BodyExtractor as an alternative to the expectedResponseType to allow to get low-level access to the received ClientHttpResponse.
    void setEncodingMode​(org.springframework.web.util.DefaultUriBuilderFactory.EncodingMode encodingMode)  
    void setPublisherElementType​(java.lang.Class<?> publisherElementType)
    Configure a type for a request Publisher elements.
    void setPublisherElementTypeExpression​(org.springframework.expression.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.

    Methods inherited from class org.springframework.integration.http.outbound.AbstractHttpRequestExecutingMessageHandler

    doInit, evaluateTypeFromExpression, getIntegrationPatternType, getReply, handleRequestMessage, isExpectReply, mapHeaders, setCharset, setEncodeUri, setExpectedResponseType, setExpectedResponseTypeExpression, setExpectReply, setExtractPayload, setHeaderMapper, setHttpMethod, setHttpMethodExpression, setTransferCookies, setTrustedSpel, setUriVariableExpressions, setUriVariablesExpression

    Methods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler

    doInvokeAdvisedRequestHandler, getBeanClassLoader, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReply

    Methods 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, updateNotPropagatedHeaders

    Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler

    handleMessage, onComplete, onError, onNext, onSubscribe

    Methods inherited from class org.springframework.integration.handler.MessageHandlerSupport

    buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack

    Methods 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, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface reactor.core.CoreSubscriber

    currentContext

    Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement

    getThisAs

    Methods inherited from interface org.springframework.integration.support.context.NamedComponent

    getBeanName, getComponentName
  • Constructor Details

    • WebFluxRequestExecutingMessageHandler

      public WebFluxRequestExecutingMessageHandler​(java.net.URI uri)
      Create a handler that will send requests to the provided URI.
      Parameters:
      uri - The URI.
    • WebFluxRequestExecutingMessageHandler

      public WebFluxRequestExecutingMessageHandler​(java.lang.String uri)
      Create a handler that will send requests to the provided URI.
      Parameters:
      uri - The URI.
    • WebFluxRequestExecutingMessageHandler

      public WebFluxRequestExecutingMessageHandler​(org.springframework.expression.Expression uriExpression)
      Create a handler that will send requests to the provided URI Expression.
      Parameters:
      uriExpression - The URI expression.
    • WebFluxRequestExecutingMessageHandler

      public WebFluxRequestExecutingMessageHandler​(java.lang.String uri, @Nullable org.springframework.web.reactive.function.client.WebClient webClient)
      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​(org.springframework.expression.Expression uriExpression, @Nullable org.springframework.web.reactive.function.client.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

    • setEncodingMode

      public void setEncodingMode​(org.springframework.web.util.DefaultUriBuilderFactory.EncodingMode encodingMode)
      Overrides:
      setEncodingMode in class org.springframework.integration.http.outbound.AbstractHttpRequestExecutingMessageHandler
    • setReplyPayloadToFlux

      public 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. Defaults to false - simple value is pushed downstream. Makes sense when expectedResponseType is configured.
      Parameters:
      replyPayloadToFlux - represent reply payload as a Flux or as a value from the Mono.
      Since:
      5.0.1
      See Also:
      AbstractHttpRequestExecutingMessageHandler.setExpectedResponseType(Class), AbstractHttpRequestExecutingMessageHandler.setExpectedResponseTypeExpression(Expression)
    • setBodyExtractor

      public void setBodyExtractor​(org.springframework.web.reactive.function.BodyExtractor<?,​org.springframework.http.client.reactive.ClientHttpResponse> bodyExtractor)
      Specify a BodyExtractor as an alternative to the expectedResponseType to allow to get low-level access to the received ClientHttpResponse.
      Parameters:
      bodyExtractor - the BodyExtractor to use.
      Since:
      5.0.1
      See Also:
      AbstractHttpRequestExecutingMessageHandler.setExpectedResponseType(Class), AbstractHttpRequestExecutingMessageHandler.setExpectedResponseTypeExpression(Expression)
    • setPublisherElementType

      public void setPublisherElementType​(java.lang.Class<?> publisherElementType)
      Configure a type for a request Publisher elements.
      Parameters:
      publisherElementType - the type of the request Publisher elements.
      Since:
      5.2
      See Also:
      BodyInserters.fromPublisher(Publisher, Class)
    • setPublisherElementTypeExpression

      public void setPublisherElementTypeExpression​(org.springframework.expression.Expression publisherElementTypeExpression)
      Configure a SpEL expression to evaluate a request Publisher elements type at runtime against a request message.
      Parameters:
      publisherElementTypeExpression - the expression to evaluate a type for the request Publisher elements.
      Since:
      5.2
      See Also:
      BodyInserters.fromPublisher(Publisher, Class), BodyInserters.fromPublisher(Publisher, ParameterizedTypeReference)
    • getComponentType

      public java.lang.String getComponentType()
      Specified by:
      getComponentType in interface org.springframework.integration.support.context.NamedComponent
      Overrides:
      getComponentType in class org.springframework.integration.handler.MessageHandlerSupport
    • exchange

      @Nullable protected java.lang.Object exchange​(java.lang.Object uri, org.springframework.http.HttpMethod httpMethod, org.springframework.http.HttpEntity<?> httpRequest, java.lang.Object expectedResponseType, org.springframework.messaging.Message<?> requestMessage, java.util.Map<java.lang.String,​?> uriVariables)
      Specified by:
      exchange in class org.springframework.integration.http.outbound.AbstractHttpRequestExecutingMessageHandler