Class AmqpChannelFactoryBean

java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<AbstractAmqpChannel>
org.springframework.integration.amqp.config.AmqpChannelFactoryBean
All Implemented Interfaces:
Aware, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware, DisposableBean, FactoryBean<AbstractAmqpChannel>, InitializingBean, Lifecycle, Phased, SmartLifecycle

public class AmqpChannelFactoryBean extends AbstractFactoryBean<AbstractAmqpChannel> implements SmartLifecycle, BeanNameAware
If point-to-point, we send to the default exchange with the routing key equal to "[beanName]" and we declare that same Queue and register a listener if message-driven or poll explicitly otherwise. If publish-subscribe, we declare a FanoutExchange named "si.fanout.[beanName]" and we send to that without any routing key, and on the receiving side, we create an anonymous Queue that is bound to that exchange.
Since:
2.1
Author:
Mark Fisher, Gary Russell, Artem Bilan, Ngoc Nhan
  • Constructor Details

    • AmqpChannelFactoryBean

      public AmqpChannelFactoryBean()
    • AmqpChannelFactoryBean

      public AmqpChannelFactoryBean(boolean messageDriven)
  • Method Details

    • setBeanName

      public void setBeanName(@Nullable String name)
      Specified by:
      setBeanName in interface BeanNameAware
    • setInterceptors

      public void setInterceptors(List<ChannelInterceptor> interceptors)
    • setAmqpAdmin

      public void setAmqpAdmin(AmqpAdmin amqpAdmin)
      This is an optional reference to an AmqpAdmin to use when declaring a Queue implicitly for a PollableAmqpChannel. It is not needed for the message-driven (Subscribable) channels since those are able to create a RabbitAdmin instance using the underlying listener container's ConnectionFactory.
      Parameters:
      amqpAdmin - The amqp admin.
    • setExchange

      public void setExchange(FanoutExchange exchange)
      Set the FanoutExchange to use. This is only relevant for publish-subscribe-channels, and even then if not provided, a FanoutExchange will be implicitly created.
      Parameters:
      exchange - The fanout exchange.
    • setQueueName

      public void setQueueName(String queueName)
      Set the Queue name to use. This is only relevant for point-to-point channels, even then if not provided, a Queue will be implicitly created.
      Parameters:
      queueName - The queue name.
    • setEncoding

      public void setEncoding(String encoding)
    • setMessageConverter

      public void setMessageConverter(MessageConverter messageConverter)
    • setTemplateChannelTransacted

      public void setTemplateChannelTransacted(boolean channelTransacted)
    • setChannelTransacted

      public void setChannelTransacted(boolean channelTransacted)
    • setConnectionFactory

      public void setConnectionFactory(ConnectionFactory connectionFactory)
    • setMessagePropertiesConverter

      public void setMessagePropertiesConverter(MessagePropertiesConverter messagePropertiesConverter)
    • setAcknowledgeMode

      public void setAcknowledgeMode(AcknowledgeMode acknowledgeMode)
    • setAdviceChain

      public void setAdviceChain(Advice[] adviceChain)
    • setAutoStartup

      public void setAutoStartup(boolean autoStartup)
    • setConcurrentConsumers

      public void setConcurrentConsumers(int concurrentConsumers)
    • setConsumersPerQueue

      public void setConsumersPerQueue(Integer consumersPerQueue)
    • setErrorHandler

      public void setErrorHandler(ErrorHandler errorHandler)
    • setExposeListenerChannel

      public void setExposeListenerChannel(boolean exposeListenerChannel)
    • setPhase

      public void setPhase(int phase)
    • setPrefetchCount

      public void setPrefetchCount(int prefetchCount)
    • setPubSub

      public void setPubSub(boolean pubSub)
    • setReceiveTimeout

      public void setReceiveTimeout(long receiveTimeout)
    • setRecoveryInterval

      public void setRecoveryInterval(long recoveryInterval)
    • setShutdownTimeout

      public void setShutdownTimeout(long shutdownTimeout)
    • setTaskExecutor

      public void setTaskExecutor(Executor taskExecutor)
    • setTransactionAttribute

      public void setTransactionAttribute(TransactionAttribute transactionAttribute)
    • setTransactionManager

      public void setTransactionManager(PlatformTransactionManager transactionManager)
    • setBatchSize

      public void setBatchSize(Integer batchSize)
    • setMaxSubscribers

      public void setMaxSubscribers(int maxSubscribers)
    • setMissingQueuesFatal

      public void setMissingQueuesFatal(Boolean missingQueuesFatal)
    • setDefaultDeliveryMode

      public void setDefaultDeliveryMode(MessageDeliveryMode defaultDeliveryMode)
    • setExtractPayload

      public void setExtractPayload(Boolean extractPayload)
    • setOutboundHeaderMapper

      public void setOutboundHeaderMapper(AmqpHeaderMapper outboundMapper)
    • setInboundHeaderMapper

      public void setInboundHeaderMapper(AmqpHeaderMapper inboundMapper)
    • setHeadersLast

      public void setHeadersLast(boolean headersLast)
    • getObjectType

      public Class<?> getObjectType()
      Specified by:
      getObjectType in interface FactoryBean<AbstractAmqpChannel>
      Specified by:
      getObjectType in class AbstractFactoryBean<AbstractAmqpChannel>
    • createInstance

      protected AbstractAmqpChannel createInstance()
      Specified by:
      createInstance in class AbstractFactoryBean<AbstractAmqpChannel>
    • isAutoStartup

      public boolean isAutoStartup()
      Specified by:
      isAutoStartup in interface SmartLifecycle
    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface Phased
      Specified by:
      getPhase in interface SmartLifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface Lifecycle
    • start

      public void start()
      Specified by:
      start in interface Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface Lifecycle
    • stop

      public void stop(Runnable callback)
      Specified by:
      stop in interface SmartLifecycle
    • destroyInstance

      protected void destroyInstance(AbstractAmqpChannel instance)
      Overrides:
      destroyInstance in class AbstractFactoryBean<AbstractAmqpChannel>