Class PollableAmqpChannel

java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.channel.AbstractMessageChannel
org.springframework.integration.amqp.channel.AbstractAmqpChannel
org.springframework.integration.amqp.channel.PollableAmqpChannel
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.channel.ExecutorChannelInterceptorAware, 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.PollableChannel, org.springframework.messaging.support.InterceptableChannel

public class PollableAmqpChannel
extends AbstractAmqpChannel
implements org.springframework.messaging.PollableChannel, org.springframework.integration.channel.ExecutorChannelInterceptorAware
A PollableChannel implementation that is backed by an AMQP Queue. Messages will be sent to the default (no-name) exchange with that Queue's name as the routing key.
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
  • Constructor Summary

    Constructors 
    Constructor Description
    PollableAmqpChannel​(java.lang.String channelName, org.springframework.amqp.core.AmqpTemplate amqpTemplate)
    Construct an instance with the supplied name, template and default header mappers used if the template is a RabbitTemplate and the message is mapped.
    PollableAmqpChannel​(java.lang.String channelName, org.springframework.amqp.core.AmqpTemplate amqpTemplate, AmqpHeaderMapper outboundMapper, AmqpHeaderMapper inboundMapper)
    Construct an instance with the supplied name, template and header mappers.
  • Method Summary

    Modifier and Type Method Description
    void addInterceptor​(int index, org.springframework.messaging.support.ChannelInterceptor interceptor)  
    void addInterceptor​(org.springframework.messaging.support.ChannelInterceptor interceptor)  
    protected void doDeclares()  
    protected org.springframework.messaging.Message<?> doReceive​(java.lang.Long timeout)  
    protected java.lang.String getRoutingKey()
    Subclasses may override this method to return a routing key.
    boolean hasExecutorInterceptors()  
    protected void onInit()  
    protected java.lang.Object performReceive​(java.lang.Long timeout)  
    org.springframework.messaging.Message<?> receive()  
    org.springframework.messaging.Message<?> receive​(long timeout)  
    org.springframework.messaging.support.ChannelInterceptor removeInterceptor​(int index)  
    boolean removeInterceptor​(org.springframework.messaging.support.ChannelInterceptor interceptor)  
    void setAmqpAdmin​(org.springframework.amqp.core.AmqpAdmin amqpAdmin)
    Provide an instance of AmqpAdmin for implicitly declaring Queues if the queueName is not provided.
    void setInterceptors​(java.util.List<org.springframework.messaging.support.ChannelInterceptor> interceptors)  
    void setQueueName​(java.lang.String queueName)
    Provide an explicitly configured queue name.

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

    getComponentType, getFullChannelName, getIChannelInterceptorList, getIntegrationPatternType, getInterceptors, getMetricsCaptor, getOverrides, registerMetricsCaptor, send, send, setDatatypes, 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.messaging.support.InterceptableChannel

    getInterceptors

    Methods inherited from interface org.springframework.messaging.MessageChannel

    send, send

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

    getBeanName, getComponentName
  • Constructor Details

    • PollableAmqpChannel

      public PollableAmqpChannel​(java.lang.String channelName, org.springframework.amqp.core.AmqpTemplate amqpTemplate)
      Construct an instance with the supplied name, template and default header mappers used if the template is a RabbitTemplate and the message is mapped.
      Parameters:
      channelName - the channel name.
      amqpTemplate - the template.
      See Also:
      AbstractAmqpChannel.setExtractPayload(boolean)
    • PollableAmqpChannel

      public PollableAmqpChannel​(java.lang.String channelName, org.springframework.amqp.core.AmqpTemplate amqpTemplate, AmqpHeaderMapper outboundMapper, AmqpHeaderMapper inboundMapper)
      Construct an instance with the supplied name, template and header mappers.
      Parameters:
      channelName - the channel name.
      amqpTemplate - the template.
      outboundMapper - the outbound mapper.
      inboundMapper - the inbound mapper.
      Since:
      4.3
      See Also:
      AbstractAmqpChannel.setExtractPayload(boolean)
  • Method Details

    • setQueueName

      public void setQueueName​(java.lang.String queueName)
      Provide an explicitly configured queue name. If this is not provided, then a Queue will be created implicitly with the channelName as its name. The implicit creation will require that either an AmqpAdmin instance has been provided or that the configured AmqpTemplate is an instance of RabbitTemplate.
      Parameters:
      queueName - The queue name.
    • setAmqpAdmin

      public void setAmqpAdmin​(org.springframework.amqp.core.AmqpAdmin amqpAdmin)
      Provide an instance of AmqpAdmin for implicitly declaring Queues if the queueName is not provided. When providing a RabbitTemplate implementation, this is not strictly necessary since a RabbitAdmin instance can be created from the template's ConnectionFactory reference.
      Parameters:
      amqpAdmin - The amqp admin.
    • getRoutingKey

      protected java.lang.String getRoutingKey()
      Description copied from class: AbstractAmqpChannel
      Subclasses may override this method to return a routing key. By default, there will be no routing key (empty string).
      Overrides:
      getRoutingKey in class AbstractAmqpChannel
      Returns:
      The routing key.
    • onInit

      protected void onInit()
      Overrides:
      onInit in class AbstractAmqpChannel
    • doDeclares

      protected void doDeclares()
      Specified by:
      doDeclares in class AbstractAmqpChannel
    • receive

      @Nullable public org.springframework.messaging.Message<?> receive()
      Specified by:
      receive in interface org.springframework.messaging.PollableChannel
    • receive

      @Nullable public org.springframework.messaging.Message<?> receive​(long timeout)
      Specified by:
      receive in interface org.springframework.messaging.PollableChannel
    • doReceive

      @Nullable protected org.springframework.messaging.Message<?> doReceive​(java.lang.Long timeout)
    • performReceive

      @Nullable protected java.lang.Object performReceive​(java.lang.Long timeout)
    • setInterceptors

      public void setInterceptors​(java.util.List<org.springframework.messaging.support.ChannelInterceptor> interceptors)
      Specified by:
      setInterceptors in interface org.springframework.messaging.support.InterceptableChannel
      Overrides:
      setInterceptors in class org.springframework.integration.channel.AbstractMessageChannel
    • addInterceptor

      public void addInterceptor​(org.springframework.messaging.support.ChannelInterceptor interceptor)
      Specified by:
      addInterceptor in interface org.springframework.messaging.support.InterceptableChannel
      Overrides:
      addInterceptor in class org.springframework.integration.channel.AbstractMessageChannel
    • addInterceptor

      public void addInterceptor​(int index, org.springframework.messaging.support.ChannelInterceptor interceptor)
      Specified by:
      addInterceptor in interface org.springframework.messaging.support.InterceptableChannel
      Overrides:
      addInterceptor in class org.springframework.integration.channel.AbstractMessageChannel
    • removeInterceptor

      public boolean removeInterceptor​(org.springframework.messaging.support.ChannelInterceptor interceptor)
      Specified by:
      removeInterceptor in interface org.springframework.messaging.support.InterceptableChannel
      Overrides:
      removeInterceptor in class org.springframework.integration.channel.AbstractMessageChannel
    • removeInterceptor

      @Nullable public org.springframework.messaging.support.ChannelInterceptor removeInterceptor​(int index)
      Specified by:
      removeInterceptor in interface org.springframework.messaging.support.InterceptableChannel
      Overrides:
      removeInterceptor in class org.springframework.integration.channel.AbstractMessageChannel
    • hasExecutorInterceptors

      public boolean hasExecutorInterceptors()
      Specified by:
      hasExecutorInterceptors in interface org.springframework.integration.channel.ExecutorChannelInterceptorAware