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
ConstructorsConstructorDescriptionRabbitAmqpListenerContainerFactory(AmqpConnectionFactory connectionFactory) Construct an instance using the providedAmqpConnectionFactory. -
Method Summary
Modifier and TypeMethodDescriptionprotected RabbitAmqpListenerContainercreateListenerContainer(@Nullable org.springframework.amqp.rabbit.listener.RabbitListenerEndpoint endpoint) voidsetAfterReceivePostProcessors(org.springframework.amqp.core.MessagePostProcessor... afterReceivePostProcessors) SetMessagePostProcessors that will be applied after message reception, before invoking theMessageListener.voidsetBatchReceiveTimeout(Long batchReceiveTimeout) The number of milliseconds of timeout for gathering batch messages.voidsetBatchSize(Integer batchSize) The size of the batch of messages to process.voidsetContainerCustomizer(org.springframework.amqp.rabbit.config.ContainerCustomizer<RabbitAmqpListenerContainer> containerCustomizer) Set aContainerCustomizerthat is invoked after a container is created and configured to enable further customization of the container.voidsetMessageConverter(org.springframework.amqp.support.converter.MessageConverter messageConverter) Set aMessageConverterfor all the listeners based on this factory.voidsetTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler) Configure aTaskSchedulerto 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, setRetryTemplateMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory
createListenerContainer
-
Constructor Details
-
RabbitAmqpListenerContainerFactory
Construct an instance using the providedAmqpConnectionFactory.- Parameters:
connectionFactory- the connection.
-
-
Method Details
-
setContainerCustomizer
public void setContainerCustomizer(org.springframework.amqp.rabbit.config.ContainerCustomizer<RabbitAmqpListenerContainer> containerCustomizer) Set aContainerCustomizerthat 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) SetMessagePostProcessors that will be applied after message reception, before invoking theMessageListener. Often used to decompress data. Processors are invoked in order, depending onPriorityOrder,Orderand finally unordered.- Parameters:
afterReceivePostProcessors- the post-processor.
-
setBatchSize
The size of the batch of messages to process. This is only option (ifbatchSize > 1) which turns the target listener container into a batch mode.- Parameters:
batchSize- the batch size.- See Also:
-
setBatchReceiveTimeout
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 aTaskSchedulerto release not fulfilled batches after timeout.- Parameters:
taskScheduler- theTaskSchedulerto use.- See Also:
-
setMessageConverter
public void setMessageConverter(org.springframework.amqp.support.converter.MessageConverter messageConverter) Set aMessageConverterfor all the listeners based on this factory.- Parameters:
messageConverter- the message converter to use- Since:
- 4.0.2
- See Also:
-
createListenerContainer
public RabbitAmqpListenerContainer createListenerContainer(@Nullable org.springframework.amqp.rabbit.listener.RabbitListenerEndpoint endpoint) - Specified by:
createListenerContainerin interfaceorg.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory<RabbitAmqpListenerContainer>- Specified by:
createListenerContainerin classorg.springframework.amqp.rabbit.config.BaseRabbitListenerContainerFactory<RabbitAmqpListenerContainer>
-
createContainerInstance
-