Class RabbitAmqpListenerContainerFactory

java.lang.Object
org.springframework.amqp.rabbit.config.BaseRabbitListenerContainerFactory<RabbitAmqpListenerContainer>
org.springframework.amqp.rabbitmq.client.config.RabbitAmqpListenerContainerFactory
All Implemented Interfaces:
org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory<RabbitAmqpListenerContainer>, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.context.ApplicationContextAware

public class RabbitAmqpListenerContainerFactory extends org.springframework.amqp.rabbit.config.BaseRabbitListenerContainerFactory<RabbitAmqpListenerContainer>
Factory for RabbitAmqpListenerContainer. To use it as default one, has to be configured with a RabbitListenerAnnotationBeanPostProcessor.DEFAULT_RABBIT_LISTENER_CONTAINER_FACTORY_BEAN_NAME.
Since:
4.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct an instance using the provided AmqpConnectionFactory.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    createListenerContainer(@Nullable org.springframework.amqp.rabbit.listener.RabbitListenerEndpoint endpoint)
     
    void
    setAfterReceivePostProcessors(org.springframework.amqp.core.MessagePostProcessor... afterReceivePostProcessors)
    Set MessagePostProcessors that will be applied after message reception, before invoking the MessageListener.
    void
    setBatchReceiveTimeout(Long batchReceiveTimeout)
    The number of milliseconds of timeout for gathering batch messages.
    void
    setBatchSize(Integer batchSize)
    The size of the batch of messages to process.
    void
    setContainerCustomizer(org.springframework.amqp.rabbit.config.ContainerCustomizer<RabbitAmqpListenerContainer> containerCustomizer)
    Set a ContainerCustomizer that is invoked after a container is created and configured to enable further customization of the container.
    void
    setMessageConverter(org.springframework.amqp.support.converter.MessageConverter messageConverter)
    Set a MessageConverter for all the listeners based on this factory.
    void
    setTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler)
    Configure a TaskScheduler to release not fulfilled batches after timeout.

    Methods inherited from class org.springframework.amqp.rabbit.config.BaseRabbitListenerContainerFactory

    applyCommonOverrides, getAdviceChain, getApplicationContext, getBeanName, getDefaultRequeueRejected, getMicrometerEnabled, getObservationEnabled, setAdviceChain, setApplicationContext, setBeanName, setBeforeSendReplyPostProcessors, setDefaultRequeueRejected, setMicrometerEnabled, setObservationEnabled, setReplyPostProcessorProvider, setReplyRecoveryCallback, setRetryTemplate

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory

    createListenerContainer
  • Constructor Details

    • RabbitAmqpListenerContainerFactory

      public RabbitAmqpListenerContainerFactory(AmqpConnectionFactory connectionFactory)
      Construct an instance using the provided AmqpConnectionFactory.
      Parameters:
      connectionFactory - the connection.
  • Method Details

    • setContainerCustomizer

      public void setContainerCustomizer(org.springframework.amqp.rabbit.config.ContainerCustomizer<RabbitAmqpListenerContainer> containerCustomizer)
      Set a ContainerCustomizer that is invoked after a container is created and configured to enable further customization of the container.
      Parameters:
      containerCustomizer - the customizer.
    • setAfterReceivePostProcessors

      public void setAfterReceivePostProcessors(org.springframework.amqp.core.MessagePostProcessor... afterReceivePostProcessors)
      Set MessagePostProcessors that will be applied after message reception, before invoking the MessageListener. Often used to decompress data. Processors are invoked in order, depending on PriorityOrder, Order and finally unordered.
      Parameters:
      afterReceivePostProcessors - the post-processor.
    • setBatchSize

      public void setBatchSize(Integer batchSize)
      The size of the batch of messages to process. This is only option (if batchSize > 1) which turns the target listener container into a batch mode.
      Parameters:
      batchSize - the batch size.
      See Also:
    • setBatchReceiveTimeout

      public void setBatchReceiveTimeout(Long batchReceiveTimeout)
      The number of milliseconds of timeout for gathering batch messages. It limits the time to wait to fill batchSize. Default is 30 seconds.
      Parameters:
      batchReceiveTimeout - the timeout for gathering batch messages.
      See Also:
    • setTaskScheduler

      public void setTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler)
      Configure a TaskScheduler to release not fulfilled batches after timeout.
      Parameters:
      taskScheduler - the TaskScheduler to use.
      See Also:
    • setMessageConverter

      public void setMessageConverter(org.springframework.amqp.support.converter.MessageConverter messageConverter)
      Set a MessageConverter for all the listeners based on this factory.
      Parameters:
      messageConverter - the message converter to use
      Since:
      4.0.2
      See Also:
      • RabbitListenerEndpoint.setMessageConverter(MessageConverter)
    • createListenerContainer

      public RabbitAmqpListenerContainer createListenerContainer(@Nullable org.springframework.amqp.rabbit.listener.RabbitListenerEndpoint endpoint)
      Specified by:
      createListenerContainer in interface org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory<RabbitAmqpListenerContainer>
      Specified by:
      createListenerContainer in class org.springframework.amqp.rabbit.config.BaseRabbitListenerContainerFactory<RabbitAmqpListenerContainer>
    • createContainerInstance

      protected RabbitAmqpListenerContainer createContainerInstance()