Class PublishSubscribeAmqpChannel

java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.channel.AbstractMessageChannel
org.springframework.integration.amqp.channel.AbstractAmqpChannel
org.springframework.integration.amqp.channel.PublishSubscribeAmqpChannel
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.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, org.springframework.integration.channel.BroadcastCapableChannel, 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.ManageableLifecycle, org.springframework.integration.support.management.ManageableSmartLifecycle, org.springframework.integration.support.management.TrackableComponent, org.springframework.messaging.MessageChannel, org.springframework.messaging.SubscribableChannel, org.springframework.messaging.support.InterceptableChannel

public class PublishSubscribeAmqpChannel
extends AbstractAmqpChannel
implements org.springframework.integration.channel.BroadcastCapableChannel
The AbstractSubscribableAmqpChannel extension for pub-sub semantics based on the FanoutExchange.
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

    Fields inherited from interface org.springframework.context.SmartLifecycle

    DEFAULT_PHASE
  • Constructor Summary

    Constructors 
    Constructor Description
    PublishSubscribeAmqpChannel​(java.lang.String channelName, org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer container, org.springframework.amqp.core.AmqpTemplate amqpTemplate)
    Construct an instance with the supplied name, container and template; default header mappers will be used if the message is mapped.
    PublishSubscribeAmqpChannel​(java.lang.String channelName, org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer container, org.springframework.amqp.core.AmqpTemplate amqpTemplate, AmqpHeaderMapper outboundMapper, AmqpHeaderMapper inboundMapper)
    Construct an instance with the supplied name, container and template; default header mappers will be used if the message is mapped.
  • Method Summary

    Modifier and Type Method Description
    protected org.springframework.integration.dispatcher.AbstractDispatcher createDispatcher()  
    void destroy()  
    protected void doDeclares()  
    protected java.lang.String getExchangeName()
    Subclasses may override this method to return an Exchange name.
    int getPhase()  
    boolean isAutoStartup()  
    boolean isRunning()  
    protected java.lang.String obtainQueueName​(java.lang.String channelName)  
    void onInit()  
    void setExchange​(org.springframework.amqp.core.FanoutExchange exchange)
    Configure the FanoutExchange instance.
    void setMaxSubscribers​(int maxSubscribers)
    Specify the maximum number of subscribers supported by the channel's dispatcher (if it is an AbstractDispatcher).
    void start()  
    void stop()  
    void stop​(java.lang.Runnable callback)  
    boolean subscribe​(org.springframework.messaging.MessageHandler handler)  
    boolean unsubscribe​(org.springframework.messaging.MessageHandler handler)  

    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.integration.channel.BroadcastCapableChannel

    isBroadcast

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

    send, send

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

    getBeanName, getComponentName

    Methods inherited from interface org.springframework.messaging.SubscribableChannel

    subscribe, unsubscribe
  • Constructor Details

    • PublishSubscribeAmqpChannel

      public PublishSubscribeAmqpChannel​(java.lang.String channelName, org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer container, org.springframework.amqp.core.AmqpTemplate amqpTemplate)
      Construct an instance with the supplied name, container and template; default header mappers will be used if the message is mapped.
      Parameters:
      channelName - the channel name.
      container - the container.
      amqpTemplate - the template.
      See Also:
      AbstractAmqpChannel.setExtractPayload(boolean)
    • PublishSubscribeAmqpChannel

      public PublishSubscribeAmqpChannel​(java.lang.String channelName, org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer container, org.springframework.amqp.core.AmqpTemplate amqpTemplate, AmqpHeaderMapper outboundMapper, AmqpHeaderMapper inboundMapper)
      Construct an instance with the supplied name, container and template; default header mappers will be used if the message is mapped.
      Parameters:
      channelName - the channel name.
      container - the container.
      amqpTemplate - the template
      outboundMapper - the outbound mapper.
      inboundMapper - the inbound mapper.
      Since:
      4.3
      See Also:
      AbstractAmqpChannel.setExtractPayload(boolean)
  • Method Details

    • setExchange

      public void setExchange​(org.springframework.amqp.core.FanoutExchange exchange)
      Configure the FanoutExchange instance. If this is not provided, then a FanoutExchange will be declared implicitly, and its name will be the same as the channel name prefixed by "si.fanout.". In either case, an effectively anonymous Queue will be declared automatically.
      Parameters:
      exchange - The fanout exchange.
    • getExchangeName

      protected java.lang.String getExchangeName()
      Description copied from class: AbstractAmqpChannel
      Subclasses may override this method to return an Exchange name. By default, Messages will be sent to the no-name Direct Exchange.
      Overrides:
      getExchangeName in class AbstractAmqpChannel
      Returns:
      The exchange name.
    • obtainQueueName

      protected java.lang.String obtainQueueName​(java.lang.String channelName)
    • createDispatcher

      protected org.springframework.integration.dispatcher.AbstractDispatcher createDispatcher()
    • doDeclares

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

      public void setMaxSubscribers​(int maxSubscribers)
      Specify the maximum number of subscribers supported by the channel's dispatcher (if it is an AbstractDispatcher).
      Parameters:
      maxSubscribers - The maximum number of subscribers allowed.
    • subscribe

      public boolean subscribe​(org.springframework.messaging.MessageHandler handler)
      Specified by:
      subscribe in interface org.springframework.messaging.SubscribableChannel
    • unsubscribe

      public boolean unsubscribe​(org.springframework.messaging.MessageHandler handler)
      Specified by:
      unsubscribe in interface org.springframework.messaging.SubscribableChannel
    • onInit

      public void onInit()
      Overrides:
      onInit in class AbstractAmqpChannel
    • isAutoStartup

      public boolean isAutoStartup()
      Specified by:
      isAutoStartup in interface org.springframework.context.SmartLifecycle
    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface org.springframework.context.Phased
      Specified by:
      getPhase in interface org.springframework.context.SmartLifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
      Specified by:
      isRunning in interface org.springframework.integration.support.management.ManageableLifecycle
    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
      Specified by:
      start in interface org.springframework.integration.support.management.ManageableLifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
      Specified by:
      stop in interface org.springframework.integration.support.management.ManageableLifecycle
    • stop

      public void stop​(java.lang.Runnable callback)
      Specified by:
      stop in interface org.springframework.context.SmartLifecycle
    • 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 AbstractAmqpChannel