Class AmqpInboundChannelAdapter

java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.endpoint.MessageProducerSupport
org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.SmartInitializingSingleton, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, org.springframework.integration.context.ExpressionCapable, org.springframework.integration.context.OrderlyShutdownCapable, org.springframework.integration.core.MessageProducer, org.springframework.integration.IntegrationPattern, org.springframework.integration.support.context.NamedComponent, org.springframework.integration.support.management.ManageableLifecycle, org.springframework.integration.support.management.ManageableSmartLifecycle, org.springframework.integration.support.management.TrackableComponent

public class AmqpInboundChannelAdapter extends org.springframework.integration.endpoint.MessageProducerSupport implements org.springframework.integration.context.OrderlyShutdownCapable
Adapter that receives Messages from an AMQP Queue, converts them into Spring Integration Messages, and sends the results to a Message Channel.
Since:
2.1
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected class 
     
    static enum 
    Defines the payload type when the listener container is configured with consumerBatchEnabled.
    protected class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Header containing List<Map<String, Object> headers when batch mode is AmqpInboundChannelAdapter.BatchMode.EXTRACT_PAYLOADS_WITH_HEADERS.

    Fields inherited from class org.springframework.integration.endpoint.AbstractEndpoint

    lifecycleCondition, lifecycleLock

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

    EXPRESSION_PARSER, logger

    Fields inherited from interface org.springframework.context.SmartLifecycle

    DEFAULT_PHASE
  • Constructor Summary

    Constructors
    Constructor
    Description
    AmqpInboundChannelAdapter(org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer listenerContainer)
     
    AmqpInboundChannelAdapter(org.springframework.amqp.rabbit.listener.MessageListenerContainer listenerContainer)
    Construct an instance using the provided container.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    int
     
    protected void
     
    protected void
     
     
    protected org.springframework.core.AttributeAccessor
    getErrorMessageAttributes(org.springframework.messaging.Message<?> message)
     
    protected void
     
    void
    setBatchingStrategy(org.springframework.amqp.rabbit.batch.BatchingStrategy batchingStrategy)
    Set a batching strategy to use when de-batching messages created by a batching producer (such as the BatchingRabbitTemplate).
    void
    When the listener container is configured with consumerBatchEnabled, set the payload type for messages generated for the batches.
    void
    setBindSourceMessage(boolean bindSourceMessage)
    Set to true to bind the source message in the header named IntegrationMessageHeaderAccessor.SOURCE_DATA.
    void
     
    void
    setMessageConverter(org.springframework.amqp.support.converter.MessageConverter messageConverter)
     
    void
    setMessageRecoverer(org.springframework.amqp.rabbit.retry.MessageRecoverer messageRecoverer)
    Configure a MessageRecoverer for retry operations.
    void
    setRecoveryCallback(org.springframework.retry.RecoveryCallback<?> recoveryCallback)
    Set a RecoveryCallback when using retry within the adapter.
    void
    setRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate)
    Set a RetryTemplate to use for retrying a message delivery within the adapter.

    Methods inherited from class org.springframework.integration.endpoint.MessageProducerSupport

    afterSingletonsInstantiated, buildErrorMessage, getErrorChannel, getErrorMessageStrategy, getIntegrationPatternType, getMessagingTemplate, getOutputChannel, sendErrorMessageIfNecessary, sendMessage, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setOutputChannel, setOutputChannelName, setSendTimeout, setShouldTrack, subscribeToPublisher

    Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint

    destroy, doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stop

    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 org.springframework.integration.support.context.NamedComponent

    getBeanName, getComponentName
  • Field Details

  • Constructor Details

    • AmqpInboundChannelAdapter

      public AmqpInboundChannelAdapter(org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer listenerContainer)
    • AmqpInboundChannelAdapter

      public AmqpInboundChannelAdapter(org.springframework.amqp.rabbit.listener.MessageListenerContainer listenerContainer)
      Construct an instance using the provided container.
      Parameters:
      listenerContainer - the container.
  • Method Details

    • setMessageConverter

      public void setMessageConverter(org.springframework.amqp.support.converter.MessageConverter messageConverter)
    • setHeaderMapper

      public void setHeaderMapper(AmqpHeaderMapper headerMapper)
    • setRetryTemplate

      public void setRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate)
      Set a RetryTemplate to use for retrying a message delivery within the adapter. Unlike adding retry at the container level, this can be used with an ErrorMessageSendingRecoverer RecoveryCallback to publish to the error channel after retries are exhausted. You generally should not configure an error channel when using retry here, use a RecoveryCallback instead.
      Parameters:
      retryTemplate - the template.
      Since:
      4.3.10.
      See Also:
    • setRecoveryCallback

      public void setRecoveryCallback(org.springframework.retry.RecoveryCallback<?> recoveryCallback)
      Set a RecoveryCallback when using retry within the adapter. Mutually exclusive with setMessageRecoverer(MessageRecoverer).
      Parameters:
      recoveryCallback - the callback.
      Since:
      4.3.10
      See Also:
    • setMessageRecoverer

      public void setMessageRecoverer(org.springframework.amqp.rabbit.retry.MessageRecoverer messageRecoverer)
      Configure a MessageRecoverer for retry operations. A more AMQP-specific convenience instead of setRecoveryCallback(RecoveryCallback).
      Parameters:
      messageRecoverer - the MessageRecoverer to use.
      Since:
      5.5
    • setBatchingStrategy

      public void setBatchingStrategy(org.springframework.amqp.rabbit.batch.BatchingStrategy batchingStrategy)
      Set a batching strategy to use when de-batching messages created by a batching producer (such as the BatchingRabbitTemplate). Default is SimpleBatchingStrategy.
      Parameters:
      batchingStrategy - the strategy.
      Since:
      5.2
    • setBindSourceMessage

      public void setBindSourceMessage(boolean bindSourceMessage)
      Set to true to bind the source message in the header named IntegrationMessageHeaderAccessor.SOURCE_DATA.
      Parameters:
      bindSourceMessage - true to bind.
      Since:
      5.1.6
    • setBatchMode

      public void setBatchMode(AmqpInboundChannelAdapter.BatchMode batchMode)
      When the listener container is configured with consumerBatchEnabled, set the payload type for messages generated for the batches. Default is AmqpInboundChannelAdapter.BatchMode.MESSAGES.
      Parameters:
      batchMode - the batch mode.
      Since:
      5.3
    • getComponentType

      public String getComponentType()
      Specified by:
      getComponentType in interface org.springframework.integration.support.context.NamedComponent
      Overrides:
      getComponentType in class org.springframework.integration.context.IntegrationObjectSupport
    • onInit

      protected void onInit()
      Overrides:
      onInit in class org.springframework.integration.endpoint.MessageProducerSupport
    • doStart

      protected void doStart()
      Overrides:
      doStart in class org.springframework.integration.endpoint.MessageProducerSupport
    • doStop

      protected void doStop()
      Overrides:
      doStop in class org.springframework.integration.endpoint.MessageProducerSupport
    • beforeShutdown

      public int beforeShutdown()
      Specified by:
      beforeShutdown in interface org.springframework.integration.context.OrderlyShutdownCapable
    • afterShutdown

      public int afterShutdown()
      Specified by:
      afterShutdown in interface org.springframework.integration.context.OrderlyShutdownCapable
    • getErrorMessageAttributes

      protected org.springframework.core.AttributeAccessor getErrorMessageAttributes(org.springframework.messaging.Message<?> message)
      Overrides:
      getErrorMessageAttributes in class org.springframework.integration.endpoint.MessageProducerSupport