Class ConsumerEndpointSpec<S extends ConsumerEndpointSpec<S,​H>,​H extends org.springframework.messaging.MessageHandler>

java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<T>
org.springframework.integration.dsl.IntegrationComponentSpec<S,​reactor.util.function.Tuple2<F,​H>>
org.springframework.integration.dsl.EndpointSpec<S,​ConsumerEndpointFactoryBean,​H>
org.springframework.integration.dsl.ConsumerEndpointSpec<S,​H>
Type Parameters:
S - the target ConsumerEndpointSpec implementation type.
H - the target MessageHandler implementation type.
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<reactor.util.function.Tuple2<ConsumerEndpointFactoryBean,​H>>, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, ComponentsRegistration
Direct Known Subclasses:
AbstractRouterSpec, BarrierSpec, CorrelationHandlerSpec, DelayerEndpointSpec, EnricherSpec, FilterEndpointSpec, GatewayEndpointSpec, GenericEndpointSpec, HeaderEnricherSpec, ScatterGatherSpec, SplitterEndpointSpec

public abstract class ConsumerEndpointSpec<S extends ConsumerEndpointSpec<S,​H>,​H extends org.springframework.messaging.MessageHandler>
extends EndpointSpec<S,​ConsumerEndpointFactoryBean,​H>
A EndpointSpec for consumer endpoints.
Since:
5.0
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.util.List<org.aopalliance.aop.Advice> adviceChain  

    Fields inherited from class org.springframework.integration.dsl.EndpointSpec

    componentsToRegister, endpointFactoryBean, handler

    Fields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec

    PARSER, target

    Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

    logger

    Fields inherited from interface org.springframework.beans.factory.FactoryBean

    OBJECT_TYPE_ATTRIBUTE

    Fields inherited from interface org.springframework.context.SmartLifecycle

    DEFAULT_PHASE
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected ConsumerEndpointSpec​(H messageHandler)  
  • Method Summary

    Modifier and Type Method Description
    S advice​(org.aopalliance.aop.Advice... advice)
    Configure a list of Advice objects to be applied, in nested order, to the endpoint's handler.
    S async​(boolean async)
    Allow async replies.
    S autoStartup​(boolean autoStartup)  
    S customizeMonoReply​(java.util.function.BiFunction<org.springframework.messaging.Message<?>,​reactor.core.publisher.Mono<?>,​org.reactivestreams.Publisher<?>> replyCustomizer)
    Specify a BiFunction for customizing Mono replies via ReactiveRequestHandlerAdvice.
    protected reactor.util.function.Tuple2<ConsumerEndpointFactoryBean,​H> doGet()  
    S handleMessageAdvice​(org.aopalliance.intercept.MethodInterceptor... interceptors)
    Configure a list of MethodInterceptor objects to be applied, in nested order, to the endpoint's handler.
    S notPropagatedHeaders​(java.lang.String... headerPatterns)
    Set header patterns ("xxx*", "*xxx", "*xxx*" or "xxx*yyy") that will NOT be copied from the inbound message.
    S order​(int order)  
    S phase​(int phase)  
    S poller​(PollerMetadata pollerMetadata)  
    S requiresReply​(boolean requiresReply)  
    S role​(java.lang.String role)
    Specify the role for the endpoint.
    S sendTimeout​(long sendTimeout)  
    S taskScheduler​(org.springframework.scheduling.TaskScheduler taskScheduler)
    Configure a TaskScheduler for scheduling tasks, for example in the Polling Consumer.
    S transactional()
    Specify a TransactionInterceptor Advice with default PlatformTransactionManager and DefaultTransactionAttribute for the MessageHandler.
    S transactional​(boolean handleMessageAdvice)
    Specify a TransactionInterceptor Advice with default PlatformTransactionManager and DefaultTransactionAttribute for the MessageHandler.
    S transactional​(org.springframework.transaction.interceptor.TransactionInterceptor transactionInterceptor)
    Specify a TransactionInterceptor Advice for the MessageHandler.
    S transactional​(org.springframework.transaction.TransactionManager transactionManager)
    Specify a TransactionInterceptor Advice with the provided PlatformTransactionManager and default DefaultTransactionAttribute for the MessageHandler.
    S transactional​(org.springframework.transaction.TransactionManager transactionManager, boolean handleMessageAdvice)
    Specify a TransactionInterceptor Advice with the provided PlatformTransactionManager and default DefaultTransactionAttribute for the MessageHandler.

    Methods inherited from class org.springframework.integration.dsl.EndpointSpec

    assertHandler, getComponentsToRegister, id, obtainInputChannelFromFlow, obtainInputChannelFromFlow, poller, poller

    Methods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec

    _this, createInstance, destroyInstance, get, getId, getObjectType, getPhase, isAutoStartup, isRunning, start, stop, stop

    Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

    afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • adviceChain

      protected final java.util.List<org.aopalliance.aop.Advice> adviceChain
  • Constructor Details

  • Method Details

    • phase

      public S phase​(int phase)
      Specified by:
      phase in class EndpointSpec<S extends ConsumerEndpointSpec<S,​H>,​ConsumerEndpointFactoryBean,​H extends org.springframework.messaging.MessageHandler>
      Parameters:
      phase - the phase.
      Returns:
      the endpoint spec.
      See Also:
      SmartLifecycle
    • autoStartup

      public S autoStartup​(boolean autoStartup)
      Specified by:
      autoStartup in class EndpointSpec<S extends ConsumerEndpointSpec<S,​H>,​ConsumerEndpointFactoryBean,​H extends org.springframework.messaging.MessageHandler>
      Parameters:
      autoStartup - the autoStartup.
      Returns:
      the endpoint spec
      See Also:
      SmartLifecycle
    • poller

      public S poller​(PollerMetadata pollerMetadata)
      Specified by:
      poller in class EndpointSpec<S extends ConsumerEndpointSpec<S,​H>,​ConsumerEndpointFactoryBean,​H extends org.springframework.messaging.MessageHandler>
      Parameters:
      pollerMetadata - the pollerMetadata
      Returns:
      the endpoint spec.
      See Also:
      AbstractPollingEndpoint
    • role

      public S role​(java.lang.String role)
      Description copied from class: EndpointSpec
      Specify the role for the endpoint. Such endpoints can be started/stopped as a group.
      Specified by:
      role in class EndpointSpec<S extends ConsumerEndpointSpec<S,​H>,​ConsumerEndpointFactoryBean,​H extends org.springframework.messaging.MessageHandler>
      Parameters:
      role - the role for this endpoint.
      Returns:
      the endpoint spec
      See Also:
      SmartLifecycle, SmartLifecycleRoleController
    • taskScheduler

      public S taskScheduler​(org.springframework.scheduling.TaskScheduler taskScheduler)
      Configure a TaskScheduler for scheduling tasks, for example in the Polling Consumer. By default the global ThreadPoolTaskScheduler bean is used. This configuration is useful when there are requirements to dedicate particular threads for polling task, for example.
      Parameters:
      taskScheduler - the TaskScheduler to use.
      Returns:
      the endpoint spec.
      See Also:
      IntegrationContextUtils.getTaskScheduler(org.springframework.beans.factory.BeanFactory)
    • handleMessageAdvice

      public S handleMessageAdvice​(org.aopalliance.intercept.MethodInterceptor... interceptors)
      Configure a list of MethodInterceptor objects to be applied, in nested order, to the endpoint's handler. The advice objects are applied to the handleMessage() method and therefore to the whole sub-flow afterwards.
      Parameters:
      interceptors - the advice chain.
      Returns:
      the endpoint spec.
      Since:
      5.3
    • advice

      public S advice​(org.aopalliance.aop.Advice... advice)
      Configure a list of Advice objects to be applied, in nested order, to the endpoint's handler. The advice objects are applied only to the handler.
      Parameters:
      advice - the advice chain.
      Returns:
      the endpoint spec.
    • transactional

      public S transactional​(org.springframework.transaction.TransactionManager transactionManager)
      Specify a TransactionInterceptor Advice with the provided PlatformTransactionManager and default DefaultTransactionAttribute for the MessageHandler.
      Parameters:
      transactionManager - the TransactionManager to use.
      Returns:
      the spec.
    • transactional

      public S transactional​(org.springframework.transaction.TransactionManager transactionManager, boolean handleMessageAdvice)
      Specify a TransactionInterceptor Advice with the provided PlatformTransactionManager and default DefaultTransactionAttribute for the MessageHandler.
      Parameters:
      transactionManager - the TransactionManager to use.
      handleMessageAdvice - the flag to indicate the target Advice type: false - regular TransactionInterceptor; true - TransactionHandleMessageAdvice extension.
      Returns:
      the spec.
    • transactional

      public S transactional​(org.springframework.transaction.interceptor.TransactionInterceptor transactionInterceptor)
      Specify a TransactionInterceptor Advice for the MessageHandler.
      Parameters:
      transactionInterceptor - the TransactionInterceptor to use.
      Returns:
      the spec.
      See Also:
      TransactionInterceptorBuilder
    • transactional

      public S transactional()
      Specify a TransactionInterceptor Advice with default PlatformTransactionManager and DefaultTransactionAttribute for the MessageHandler.
      Returns:
      the spec.
    • transactional

      public S transactional​(boolean handleMessageAdvice)
      Specify a TransactionInterceptor Advice with default PlatformTransactionManager and DefaultTransactionAttribute for the MessageHandler.
      Parameters:
      handleMessageAdvice - the flag to indicate the target Advice type: false - regular TransactionInterceptor; true - TransactionHandleMessageAdvice extension.
      Returns:
      the spec.
    • customizeMonoReply

      public S customizeMonoReply​(java.util.function.BiFunction<org.springframework.messaging.Message<?>,​reactor.core.publisher.Mono<?>,​org.reactivestreams.Publisher<?>> replyCustomizer)
      Specify a BiFunction for customizing Mono replies via ReactiveRequestHandlerAdvice.
      Parameters:
      replyCustomizer - the BiFunction to propagate into ReactiveRequestHandlerAdvice.
      Returns:
      the spec.
      Since:
      5.3
      See Also:
      ReactiveRequestHandlerAdvice
    • requiresReply

      public S requiresReply​(boolean requiresReply)
      Parameters:
      requiresReply - the requiresReply.
      Returns:
      the endpoint spec.
      See Also:
      AbstractReplyProducingMessageHandler.setRequiresReply(boolean)
    • sendTimeout

      public S sendTimeout​(long sendTimeout)
      Parameters:
      sendTimeout - the send timeout.
      Returns:
      the endpoint spec.
      See Also:
      AbstractMessageProducingHandler.setSendTimeout(long)
    • order

      public S order​(int order)
      Parameters:
      order - the order.
      Returns:
      the endpoint spec.
      See Also:
      MessageHandlerSupport.setOrder(int)
    • async

      public S async​(boolean async)
      Allow async replies. If the handler reply is a org.springframework.util.concurrent.ListenableFuture, send the output when it is satisfied rather than sending the future as the result. Ignored for handler return types other than ListenableFuture.
      Parameters:
      async - true to allow.
      Returns:
      the endpoint spec.
      See Also:
      AbstractMessageProducingHandler.setAsync(boolean)
    • notPropagatedHeaders

      public S notPropagatedHeaders​(java.lang.String... headerPatterns)
      Set header patterns ("xxx*", "*xxx", "*xxx*" or "xxx*yyy") that will NOT be copied from the inbound message. At least one pattern as "*" means do not copy headers at all.
      Parameters:
      headerPatterns - the headers to not propagate from the inbound message.
      Returns:
      the endpoint spec.
      See Also:
      AbstractMessageProducingHandler.setNotPropagatedHeaders(String...)
    • doGet

      protected reactor.util.function.Tuple2<ConsumerEndpointFactoryBean,​H> doGet()
      Overrides:
      doGet in class EndpointSpec<S extends ConsumerEndpointSpec<S,​H>,​ConsumerEndpointFactoryBean,​H extends org.springframework.messaging.MessageHandler>