Class AbstractAmqpChannel

java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.channel.AbstractMessageChannel
org.springframework.integration.amqp.channel.AbstractAmqpChannel
All Implemented Interfaces:
org.springframework.amqp.rabbit.connection.ConnectionListener, 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.context.ApplicationContextAware, org.springframework.integration.context.ExpressionCapable, 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.MessageChannel, org.springframework.messaging.support.InterceptableChannel
Direct Known Subclasses:
PointToPointSubscribableAmqpChannel, PollableAmqpChannel, PublishSubscribeAmqpChannel

public abstract class AbstractAmqpChannel
extends org.springframework.integration.channel.AbstractMessageChannel
implements org.springframework.amqp.rabbit.connection.ConnectionListener
The base AbstractMessageChannel implementation for AMQP.
Since:
2.1
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.integration.channel.AbstractMessageChannel

    org.springframework.integration.channel.AbstractMessageChannel.ChannelInterceptorList

    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.channel.AbstractMessageChannel

    interceptors, meters

    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.messaging.MessageChannel

    INDEFINITE_TIMEOUT
  • Method Summary

    Modifier and Type Method Description
    void destroy()  
    protected abstract void doDeclares()  
    protected boolean doSend​(org.springframework.messaging.Message<?> message, long timeout)  
    protected org.springframework.amqp.core.AmqpAdmin getAdmin()  
    protected org.springframework.amqp.core.AmqpTemplate getAmqpTemplate()  
    protected org.springframework.amqp.rabbit.connection.ConnectionFactory getConnectionFactory()  
    protected java.lang.String getExchangeName()
    Subclasses may override this method to return an Exchange name.
    protected AmqpHeaderMapper getInboundHeaderMapper()  
    protected org.springframework.amqp.rabbit.core.RabbitTemplate getRabbitTemplate()  
    protected java.lang.String getRoutingKey()
    Subclasses may override this method to return a routing key.
    protected boolean isExtractPayload()  
    boolean isLoggingEnabled()  
    void onClose​(org.springframework.amqp.rabbit.connection.Connection connection)  
    void onCreate​(org.springframework.amqp.rabbit.connection.Connection connection)  
    protected void onInit()  
    protected void setAdmin​(org.springframework.amqp.core.AmqpAdmin admin)  
    protected void setConnectionFactory​(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory)  
    void setDefaultDeliveryMode​(org.springframework.amqp.core.MessageDeliveryMode defaultDeliveryMode)
    Set the delivery mode to use if the message has no "amqp_deliveryMode" header and the message property was not set by the MessagePropertiesConverter.
    void setExtractPayload​(boolean extractPayload)
    Set to true to extract the payload and map the headers; otherwise the entire message is converted and sent.
    void setHeadersMappedLast​(boolean headersMappedLast)
    When mapping headers for the outbound message, determine whether the headers are mapped before the message is converted, or afterwards.
    void setLoggingEnabled​(boolean loggingEnabled)  

    Methods inherited from class org.springframework.integration.channel.AbstractMessageChannel

    addInterceptor, addInterceptor, getComponentType, getFullChannelName, getIChannelInterceptorList, getIntegrationPatternType, getInterceptors, getMetricsCaptor, getOverrides, registerMetricsCaptor, removeInterceptor, removeInterceptor, send, send, setDatatypes, setInterceptors, setMessageConverter, setShouldTrack

    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.amqp.rabbit.connection.ConnectionListener

    onFailed, onShutDown

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

    getManagedName, getManagedType, getThisAs, setManagedName, setManagedType

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

    getBeanName, getComponentName
  • Method Details

    • isLoggingEnabled

      public boolean isLoggingEnabled()
      Specified by:
      isLoggingEnabled in interface org.springframework.integration.support.management.IntegrationManagement
      Overrides:
      isLoggingEnabled in class org.springframework.integration.channel.AbstractMessageChannel
    • setLoggingEnabled

      public void setLoggingEnabled​(boolean loggingEnabled)
      Specified by:
      setLoggingEnabled in interface org.springframework.integration.support.management.IntegrationManagement
      Overrides:
      setLoggingEnabled in class org.springframework.integration.channel.AbstractMessageChannel
    • setDefaultDeliveryMode

      public void setDefaultDeliveryMode​(org.springframework.amqp.core.MessageDeliveryMode defaultDeliveryMode)
      Set the delivery mode to use if the message has no "amqp_deliveryMode" header and the message property was not set by the MessagePropertiesConverter.
      Parameters:
      defaultDeliveryMode - the default delivery mode.
      Since:
      4.3
    • setExtractPayload

      public void setExtractPayload​(boolean extractPayload)
      Set to true to extract the payload and map the headers; otherwise the entire message is converted and sent. Default false.
      Parameters:
      extractPayload - true to extract and map.
      Since:
      4.3
    • isExtractPayload

      protected boolean isExtractPayload()
      Returns:
      the extract payload.
      Since:
      4.3
      See Also:
      setExtractPayload(boolean)
    • setHeadersMappedLast

      public void setHeadersMappedLast​(boolean headersMappedLast)
      When mapping headers for the outbound 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. Only applies when extractPayload is true. Default: false.
      Parameters:
      headersMappedLast - true if headers are mapped after conversion.
      Since:
      5.0
    • getExchangeName

      protected java.lang.String getExchangeName()
      Subclasses may override this method to return an Exchange name. By default, Messages will be sent to the no-name Direct Exchange.
      Returns:
      The exchange name.
    • getRoutingKey

      protected java.lang.String getRoutingKey()
      Subclasses may override this method to return a routing key. By default, there will be no routing key (empty string).
      Returns:
      The routing key.
    • getInboundHeaderMapper

      protected AmqpHeaderMapper getInboundHeaderMapper()
    • getAmqpTemplate

      protected org.springframework.amqp.core.AmqpTemplate getAmqpTemplate()
    • getRabbitTemplate

      protected org.springframework.amqp.rabbit.core.RabbitTemplate getRabbitTemplate()
    • setAdmin

      protected final void setAdmin​(org.springframework.amqp.core.AmqpAdmin admin)
    • setConnectionFactory

      protected final void setConnectionFactory​(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory)
    • getAdmin

      protected org.springframework.amqp.core.AmqpAdmin getAdmin()
    • getConnectionFactory

      protected org.springframework.amqp.rabbit.connection.ConnectionFactory getConnectionFactory()
    • onInit

      protected void onInit()
      Overrides:
      onInit in class org.springframework.integration.channel.AbstractMessageChannel
    • destroy

      public void destroy()
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Specified by:
      destroy in interface org.springframework.integration.support.management.IntegrationManagement
      Overrides:
      destroy in class org.springframework.integration.channel.AbstractMessageChannel
    • doSend

      protected boolean doSend​(org.springframework.messaging.Message<?> message, long timeout)
      Specified by:
      doSend in class org.springframework.integration.channel.AbstractMessageChannel
    • onCreate

      public void onCreate​(org.springframework.amqp.rabbit.connection.Connection connection)
      Specified by:
      onCreate in interface org.springframework.amqp.rabbit.connection.ConnectionListener
    • onClose

      public void onClose​(org.springframework.amqp.rabbit.connection.Connection connection)
      Specified by:
      onClose in interface org.springframework.amqp.rabbit.connection.ConnectionListener
    • doDeclares

      protected abstract void doDeclares()