Class AmqpInboundGateway

All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, Lifecycle, Phased, SmartLifecycle, ExpressionCapable, IntegrationPattern, NamedComponent, IntegrationInboundManagement, IntegrationManagement, ManageableLifecycle, ManageableSmartLifecycle, TrackableComponent

public class AmqpInboundGateway extends MessagingGatewaySupport
Adapter that receives Messages from an AMQP Queue, converts them into Spring Integration Messages, and sends the results to a Message Channel. If a reply Message is received, it will be converted and sent back to the AMQP 'replyTo'.
Since:
2.1
Author:
Mark Fisher, Artem Bilan, Gary Russell
  • Constructor Details

  • Method Details

    • setMessageConverter

      public void setMessageConverter(MessageConverter messageConverter)
      Specify the MessageConverter to convert request and reply to/from Message. If the amqpTemplate is explicitly set, this MessageConverter isn't populated there. You must configure that external amqpTemplate.
      Parameters:
      messageConverter - the MessageConverter to use.
    • setHeaderMapper

      public void setHeaderMapper(AmqpHeaderMapper headerMapper)
    • setDefaultReplyTo

      public void setDefaultReplyTo(String defaultReplyTo)
      The defaultReplyTo address with the form
       (exchange)/(routingKey)
       
      or
       (queueName)
       
      if the request message doesn't have a replyTo property. The second form uses the default exchange ("") and the queue name as the routing key.
      Parameters:
      defaultReplyTo - the default replyTo address to use.
      Since:
      4.2
      See Also:
    • setRetryTemplate

      public void setRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate)
      Set a RetryTemplate to use for retrying a message delivery within the gateway. 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<? extends Object> recoveryCallback)
      Set a RecoveryCallback when using retry within the gateway. Mutually exclusive with setMessageRecoverer(MessageRecoverer).
      Parameters:
      recoveryCallback - the callback.
      Since:
      4.3.10
      See Also:
    • setMessageRecoverer

      public void setMessageRecoverer(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(BatchingStrategy batchingStrategy)
      Set a batching strategy to use when de-batching messages. 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
    • setReplyHeadersMappedLast

      public void setReplyHeadersMappedLast(boolean replyHeadersMappedLast)
      When mapping headers for the outbound (reply) message, determine whether the headers are mapped before the message is converted, or afterwards. This only affects headers that might be added by the message converter. When false, the converter's headers win; when true, any headers added by the converter will be overridden (if the source message has a header that maps to those headers). You might wish to set this to true, for example, when using a SimpleMessageConverter with a String payload that contains json; the converter will set the content type to text/plain which can be overridden to application/json by setting the AmqpHeaders.CONTENT_TYPE message header. Default: false.
      Parameters:
      replyHeadersMappedLast - true if reply headers are mapped after conversion.
      Since:
      5.1.9
    • getComponentType

      public String getComponentType()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this method to provide component type information.
      Specified by:
      getComponentType in interface NamedComponent
      Overrides:
      getComponentType in class MessagingGatewaySupport
    • onInit

      protected void onInit()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this for initialization logic.
      Overrides:
      onInit in class MessagingGatewaySupport
    • doStart

      protected void doStart()
      Description copied from class: AbstractEndpoint
      Subclasses must implement this method with the start behavior. This method will be invoked while holding the AbstractEndpoint.lifecycleLock.
      Overrides:
      doStart in class MessagingGatewaySupport
    • doStop

      protected void doStop()
      Description copied from class: AbstractEndpoint
      Subclasses must implement this method with the stop behavior. This method will be invoked while holding the AbstractEndpoint.lifecycleLock.
      Overrides:
      doStop in class MessagingGatewaySupport
    • getErrorMessageAttributes

      protected AttributeAccessor getErrorMessageAttributes(Message<?> message)
      Description copied from class: MessagingGatewaySupport
      Populate an AttributeAccessor to be used when building an error message with the errorMessageStrategy.
      Overrides:
      getErrorMessageAttributes in class MessagingGatewaySupport
      Parameters:
      message - the message.
      Returns:
      the attributes.