Class ListenerContainerFactoryBean
java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<AbstractMessageListenerContainer>
org.springframework.amqp.rabbit.config.ListenerContainerFactoryBean
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.FactoryBean<AbstractMessageListenerContainer>,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationEventPublisherAware,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle
public class ListenerContainerFactoryBean
extends org.springframework.beans.factory.config.AbstractFactoryBean<AbstractMessageListenerContainer>
implements org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.BeanNameAware, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.SmartLifecycle
A Factory bean to create a listener container.
- Since:
- 2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe container type. -
Field Summary
Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
loggerFields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTEFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected AbstractMessageListenerContainerClass<?>intgetPhase()booleanbooleanvoidsetAcknowledgeMode(org.springframework.amqp.core.AcknowledgeMode acknowledgeMode) voidsetAdviceChain(org.aopalliance.aop.Advice... adviceChain) voidsetAfterReceivePostProcessors(org.springframework.amqp.core.MessagePostProcessor... afterReceivePostProcessors) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) voidsetAutoDeclare(boolean autoDeclare) voidsetAutoStartup(boolean autoStartup) voidsetBatchSize(int batchSize) This property has several functions.voidsetBeanName(String beanName) voidsetChannelTransacted(boolean transactional) voidsetConcurrentConsumers(int concurrentConsumers) voidsetConnectionFactory(ConnectionFactory connectionFactory) voidsetConsecutiveActiveTrigger(int consecutiveActiveTrigger) voidsetConsecutiveIdleTrigger(int consecutiveIdleTrigger) voidsetConsumerArguments(Map<String, Object> args) voidsetConsumerBatchEnabled(boolean consumerBatchEnabled) Set to true to present a list of messages based on thesetBatchSize(int), if the container and listener support it.voidsetConsumersPerQueue(int consumersPerQueue) voidsetConsumerTagStrategy(org.springframework.amqp.support.ConsumerTagStrategy consumerTagStrategy) voidsetDeBatchingEnabled(boolean deBatchingEnabled) voidsetDeclarationRetries(int declarationRetries) voidsetDefaultRequeueRejected(boolean defaultRequeueRejected) voidSet aContainerCustomizerthat is invoked after a container is created and configured to enable further customization of the container.voidsetErrorHandler(org.springframework.util.ErrorHandler errorHandler) voidsetExclusive(boolean exclusive) voidsetExclusiveConsumerExceptionLogger(org.springframework.amqp.support.ConditionalExceptionLogger exclusiveConsumerExceptionLogger) voidsetExposeListenerChannel(boolean exposeListenerChannel) voidsetFailedDeclarationRetryInterval(long failedDeclarationRetryInterval) voidsetGlobalQos(boolean globalQos) Apply prefetch to the entire channel.voidsetIdleEventInterval(long idleEventInterval) voidsetListenerId(String listenerId) voidsetMaxConcurrentConsumers(int maxConcurrentConsumers) voidsetMessageListener(org.springframework.amqp.core.MessageListener messageListener) voidsetMessagePropertiesConverter(MessagePropertiesConverter messagePropertiesConverter) voidsetMicrometerEnabled(boolean enabled) Set to false to disable micrometer listener timers.voidsetMicrometerTags(Map<String, String> tags) Set additional tags for the Micrometer listener timers.voidsetMismatchedQueuesFatal(boolean mismatchedQueuesFatal) voidsetMissingQueuesFatal(boolean missingQueuesFatal) voidsetMonitorInterval(long monitorInterval) voidsetNoLocal(Boolean noLocal) voidsetPhase(int phase) voidsetPossibleAuthenticationFailureFatal(Boolean possibleAuthenticationFailureFatal) voidsetPrefetchCount(int prefetchCount) voidsetQueueNames(String... queueName) voidsetQueues(org.springframework.amqp.core.Queue... queues) voidsetRabbitAdmin(RabbitAdmin rabbitAdmin) voidsetReceiveTimeout(long receiveTimeout) voidsetRecoveryBackOff(org.springframework.util.backoff.BackOff recoveryBackOff) voidsetRecoveryInterval(long recoveryInterval) voidsetRetryDeclarationInterval(long retryDeclarationInterval) voidsetShutdownTimeout(long shutdownTimeout) voidSet aContainerCustomizerthat is invoked after a container is created and configured to enable further customization of the container.voidsetStartConsumerMinInterval(long startConsumerMinInterval) voidsetStopConsumerMinInterval(long stopConsumerMinInterval) voidsetTaskExecutor(Executor taskExecutor) voidsetTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler) voidsetTransactionAttribute(org.springframework.transaction.interceptor.TransactionAttribute transactionAttribute) voidsetTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) voidvoidstart()voidstop()voidMethods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, destroyInstance, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
-
Constructor Details
-
ListenerContainerFactoryBean
public ListenerContainerFactoryBean()
-
-
Method Details
-
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) - Specified by:
setApplicationEventPublisherin interfaceorg.springframework.context.ApplicationEventPublisherAware
-
setBeanName
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
setType
-
setConnectionFactory
-
setChannelTransacted
public void setChannelTransacted(boolean transactional) -
setAcknowledgeMode
public void setAcknowledgeMode(org.springframework.amqp.core.AcknowledgeMode acknowledgeMode) -
setQueueNames
-
setQueues
public void setQueues(org.springframework.amqp.core.Queue... queues) -
setExposeListenerChannel
public void setExposeListenerChannel(boolean exposeListenerChannel) -
setMessageListener
public void setMessageListener(org.springframework.amqp.core.MessageListener messageListener) -
setErrorHandler
public void setErrorHandler(org.springframework.util.ErrorHandler errorHandler) -
setDeBatchingEnabled
public void setDeBatchingEnabled(boolean deBatchingEnabled) -
setAdviceChain
public void setAdviceChain(org.aopalliance.aop.Advice... adviceChain) -
setAfterReceivePostProcessors
public void setAfterReceivePostProcessors(org.springframework.amqp.core.MessagePostProcessor... afterReceivePostProcessors) -
setAutoStartup
public void setAutoStartup(boolean autoStartup) -
setPhase
public void setPhase(int phase) -
setListenerId
-
setConsumerTagStrategy
public void setConsumerTagStrategy(org.springframework.amqp.support.ConsumerTagStrategy consumerTagStrategy) -
setConsumerArguments
-
setNoLocal
-
setExclusive
public void setExclusive(boolean exclusive) -
setDefaultRequeueRejected
public void setDefaultRequeueRejected(boolean defaultRequeueRejected) -
setPrefetchCount
public void setPrefetchCount(int prefetchCount) -
setGlobalQos
public void setGlobalQos(boolean globalQos) Apply prefetch to the entire channel.- Parameters:
globalQos- true for a channel-wide prefetch.- Since:
- 2.2.17
- See Also:
-
Channel.basicQos(int, boolean)
-
setShutdownTimeout
public void setShutdownTimeout(long shutdownTimeout) -
setIdleEventInterval
public void setIdleEventInterval(long idleEventInterval) -
setTransactionManager
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) -
setTransactionAttribute
public void setTransactionAttribute(org.springframework.transaction.interceptor.TransactionAttribute transactionAttribute) -
setTaskExecutor
-
setRecoveryInterval
public void setRecoveryInterval(long recoveryInterval) -
setRecoveryBackOff
public void setRecoveryBackOff(org.springframework.util.backoff.BackOff recoveryBackOff) -
setMessagePropertiesConverter
-
setRabbitAdmin
-
setMissingQueuesFatal
public void setMissingQueuesFatal(boolean missingQueuesFatal) -
setPossibleAuthenticationFailureFatal
-
setMismatchedQueuesFatal
public void setMismatchedQueuesFatal(boolean mismatchedQueuesFatal) -
setAutoDeclare
public void setAutoDeclare(boolean autoDeclare) -
setFailedDeclarationRetryInterval
public void setFailedDeclarationRetryInterval(long failedDeclarationRetryInterval) -
setExclusiveConsumerExceptionLogger
public void setExclusiveConsumerExceptionLogger(org.springframework.amqp.support.ConditionalExceptionLogger exclusiveConsumerExceptionLogger) -
setConsumersPerQueue
public void setConsumersPerQueue(int consumersPerQueue) -
setTaskScheduler
public void setTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler) -
setMonitorInterval
public void setMonitorInterval(long monitorInterval) -
setConcurrentConsumers
public void setConcurrentConsumers(int concurrentConsumers) -
setMaxConcurrentConsumers
public void setMaxConcurrentConsumers(int maxConcurrentConsumers) -
setStartConsumerMinInterval
public void setStartConsumerMinInterval(long startConsumerMinInterval) -
setStopConsumerMinInterval
public void setStopConsumerMinInterval(long stopConsumerMinInterval) -
setConsecutiveActiveTrigger
public void setConsecutiveActiveTrigger(int consecutiveActiveTrigger) -
setConsecutiveIdleTrigger
public void setConsecutiveIdleTrigger(int consecutiveIdleTrigger) -
setReceiveTimeout
public void setReceiveTimeout(long receiveTimeout) -
setBatchSize
public void setBatchSize(int batchSize) This property has several functions.When the channel is transacted, it determines how many messages to process in a single transaction. It should be less than or equal to
the prefetch count.It also affects how often acks are sent when using
AcknowledgeMode.AUTO- one ack per BatchSize.Finally, when
setConsumerBatchEnabled(boolean)is true, it determines how many records to include in the batch as long as sufficient messages arrive withinsetReceiveTimeout(long).IMPORTANT The batch size represents the number of physical messages received. If
setDeBatchingEnabled(boolean)is true and a message is a batch created by a producer, the actual number of messages received by the listener will be larger than this batch size.Default is 1.
- Parameters:
batchSize- the batch size- Since:
- 2.2
-
setConsumerBatchEnabled
public void setConsumerBatchEnabled(boolean consumerBatchEnabled) Set to true to present a list of messages based on thesetBatchSize(int), if the container and listener support it.- Parameters:
consumerBatchEnabled- true to create message batches in the container.- Since:
- 2.2
- See Also:
-
setDeclarationRetries
public void setDeclarationRetries(int declarationRetries) -
setRetryDeclarationInterval
public void setRetryDeclarationInterval(long retryDeclarationInterval) -
setMicrometerEnabled
public void setMicrometerEnabled(boolean enabled) Set to false to disable micrometer listener timers.- Parameters:
enabled- false to disable.- Since:
- 2.4.6
-
setMicrometerTags
Set additional tags for the Micrometer listener timers.- Parameters:
tags- the tags.- Since:
- 2.4.6
-
setSMLCCustomizer
Set aContainerCustomizerthat is invoked after a container is created and configured to enable further customization of the container.- Parameters:
customizer- the customizer.- Since:
- 2.4.6
-
setDMLCCustomizer
Set aContainerCustomizerthat is invoked after a container is created and configured to enable further customization of the container.- Parameters:
customizer- the customizer.- Since:
- 2.4.6
-
getObjectType
- Specified by:
getObjectTypein interfaceorg.springframework.beans.factory.FactoryBean<AbstractMessageListenerContainer>- Specified by:
getObjectTypein classorg.springframework.beans.factory.config.AbstractFactoryBean<AbstractMessageListenerContainer>
-
createInstance
- Specified by:
createInstancein classorg.springframework.beans.factory.config.AbstractFactoryBean<AbstractMessageListenerContainer>
-
start
public void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
getPhase
public int getPhase()- Specified by:
getPhasein interfaceorg.springframework.context.Phased- Specified by:
getPhasein interfaceorg.springframework.context.SmartLifecycle
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartupin interfaceorg.springframework.context.SmartLifecycle
-
stop
- Specified by:
stopin interfaceorg.springframework.context.SmartLifecycle
-