Class AbstractRabbitListenerContainerFactory<C extends AbstractMessageListenerContainer>
java.lang.Object
org.springframework.amqp.rabbit.config.BaseRabbitListenerContainerFactory<C>
org.springframework.amqp.rabbit.config.AbstractRabbitListenerContainerFactory<C>
- Type Parameters:
C- the container type.
- All Implemented Interfaces:
RabbitListenerContainerFactory<C>,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationEventPublisherAware
- Direct Known Subclasses:
DirectRabbitListenerContainerFactory,SimpleRabbitListenerContainerFactory
public abstract class AbstractRabbitListenerContainerFactory<C extends AbstractMessageListenerContainer>
extends BaseRabbitListenerContainerFactory<C>
implements org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationEventPublisherAware
RabbitListenerContainerFactory
for Spring's base container implementation.- Since:
- 1.4
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AtomicIntegerprotected final org.apache.commons.logging.Log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract CCreate an empty container instance.Create aMessageListenerContainerfor the givenRabbitListenerEndpoint.org.aopalliance.aop.Advice[]protected voidinitializeContainer(C instance, RabbitListenerEndpoint endpoint) Further initialize the specified container.voidsetAcknowledgeMode(org.springframework.amqp.core.AcknowledgeMode acknowledgeMode) voidsetAdviceChain(org.aopalliance.aop.Advice... adviceChain) voidsetAfterReceivePostProcessors(org.springframework.amqp.core.MessagePostProcessor... postProcessors) Set post processors which will be applied after the Message is received.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) voidsetAutoStartup(Boolean autoStartup) voidsetBatchingStrategy(BatchingStrategy batchingStrategy) Set aBatchingStrategyto use when debatching messages.voidsetBatchListener(boolean isBatch) Set to true to receive a list of debatched messages that were created by aBatchingRabbitTemplate.voidsetChannelTransacted(Boolean channelTransacted) voidsetConnectionFactory(ConnectionFactory connectionFactory) voidsetConsumerTagStrategy(org.springframework.amqp.support.ConsumerTagStrategy consumerTagStrategy) voidsetContainerCustomizer(ContainerCustomizer<C> containerCustomizer) Set aContainerCustomizerthat is invoked after a container is created and configured to enable further customization of the container.voidsetDeBatchingEnabled(Boolean deBatchingEnabled) Determine whether or not the container should de-batch batched messages (true) or call the listener with the batch (false).voidsetErrorHandler(org.springframework.util.ErrorHandler errorHandler) voidsetFailedDeclarationRetryInterval(Long failedDeclarationRetryInterval) voidsetGlobalQos(boolean globalQos) Apply prefetch to the entire channel.voidsetIdleEventInterval(Long idleEventInterval) How often to publish idle container events.voidsetMessageConverter(org.springframework.amqp.support.converter.MessageConverter messageConverter) voidsetMismatchedQueuesFatal(Boolean mismatchedQueuesFatal) voidsetMissingQueuesFatal(Boolean missingQueuesFatal) voidsetPhase(int phase) voidsetPrefetchCount(Integer prefetch) voidsetRecoveryBackOff(org.springframework.util.backoff.BackOff recoveryBackOff) voidsetRecoveryInterval(Long recoveryInterval) voidsetTaskExecutor(Executor taskExecutor) voidsetTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) Methods inherited from class org.springframework.amqp.rabbit.config.BaseRabbitListenerContainerFactory
applyCommonOverrides, getDefaultRequeueRejected, setBeforeSendReplyPostProcessors, setDefaultRequeueRejected, setReplyRecoveryCallback, setRetryTemplateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory
createListenerContainer
-
Field Details
-
logger
protected final org.apache.commons.logging.Log logger -
counter
-
-
Constructor Details
-
AbstractRabbitListenerContainerFactory
public AbstractRabbitListenerContainerFactory()
-
-
Method Details
-
setConnectionFactory
- Parameters:
connectionFactory- The connection factory.- See Also:
-
setErrorHandler
public void setErrorHandler(org.springframework.util.ErrorHandler errorHandler) - Parameters:
errorHandler- The error handler.- See Also:
-
setMessageConverter
public void setMessageConverter(org.springframework.amqp.support.converter.MessageConverter messageConverter) - Parameters:
messageConverter- the message converter to use- See Also:
-
setAcknowledgeMode
public void setAcknowledgeMode(org.springframework.amqp.core.AcknowledgeMode acknowledgeMode) - Parameters:
acknowledgeMode- the acknowledge mode to set. Defaults toAcknowledgeMode.AUTO- See Also:
-
setChannelTransacted
- Parameters:
channelTransacted- the flag value to set- See Also:
-
setTaskExecutor
- Parameters:
taskExecutor- theExecutorto use.- See Also:
-
setTransactionManager
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) - Parameters:
transactionManager- thePlatformTransactionManagerto use.- See Also:
-
setPrefetchCount
- Parameters:
prefetch- the prefetch count- See Also:
-
getAdviceChain
@Nullable public org.aopalliance.aop.Advice[] getAdviceChain()- Returns:
- the advice chain that was set. Defaults to
null. - Since:
- 1.7.4
-
setAdviceChain
public void setAdviceChain(org.aopalliance.aop.Advice... adviceChain) - Parameters:
adviceChain- the advice chain to set.- See Also:
-
setRecoveryInterval
- Parameters:
recoveryInterval- The recovery interval.- See Also:
-
setRecoveryBackOff
public void setRecoveryBackOff(org.springframework.util.backoff.BackOff recoveryBackOff) - Parameters:
recoveryBackOff- The BackOff to recover.- Since:
- 1.5
- See Also:
-
setMissingQueuesFatal
- Parameters:
missingQueuesFatal- the missingQueuesFatal to set.- See Also:
-
setMismatchedQueuesFatal
- Parameters:
mismatchedQueuesFatal- the mismatchedQueuesFatal to set.- Since:
- 1.6
- See Also:
-
setConsumerTagStrategy
public void setConsumerTagStrategy(org.springframework.amqp.support.ConsumerTagStrategy consumerTagStrategy) - Parameters:
consumerTagStrategy- the consumerTagStrategy to set- See Also:
-
setIdleEventInterval
How often to publish idle container events.- Parameters:
idleEventInterval- the interval.
-
setFailedDeclarationRetryInterval
-
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) - Specified by:
setApplicationEventPublisherin interfaceorg.springframework.context.ApplicationEventPublisherAware
-
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
-
setAutoStartup
- Parameters:
autoStartup- true for auto startup.- See Also:
-
setPhase
public void setPhase(int phase) - Parameters:
phase- The phase.- See Also:
-
setAfterReceivePostProcessors
public void setAfterReceivePostProcessors(org.springframework.amqp.core.MessagePostProcessor... postProcessors) Set post processors which will be applied after the Message is received.- Parameters:
postProcessors- the post processors.- Since:
- 2.0
- See Also:
-
setContainerCustomizer
Set aContainerCustomizerthat is invoked after a container is created and configured to enable further customization of the container.- Parameters:
containerCustomizer- the customizer.- Since:
- 2.2.2
-
setBatchListener
public void setBatchListener(boolean isBatch) Set to true to receive a list of debatched messages that were created by aBatchingRabbitTemplate.- Parameters:
isBatch- true for a batch listener.- Since:
- 2.2
- See Also:
-
setBatchingStrategy
Set aBatchingStrategyto use when debatching messages.- Parameters:
batchingStrategy- the batching strategy.- Since:
- 2.2
- See Also:
-
setDeBatchingEnabled
Determine whether or not the container should de-batch batched messages (true) or call the listener with the batch (false). Default: true.- Parameters:
deBatchingEnabled- whether or not to disable de-batching of messages.- Since:
- 2.2
- See Also:
-
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)
-
createListenerContainer
Description copied from interface:RabbitListenerContainerFactoryCreate aMessageListenerContainerfor the givenRabbitListenerEndpoint.- Specified by:
createListenerContainerin interfaceRabbitListenerContainerFactory<C extends AbstractMessageListenerContainer>- Specified by:
createListenerContainerin classBaseRabbitListenerContainerFactory<C extends AbstractMessageListenerContainer>- Parameters:
endpoint- the endpoint to configure.- Returns:
- the created container.
-
createContainerInstance
Create an empty container instance.- Returns:
- the new container instance.
-
initializeContainer
Further initialize the specified container.Subclasses can inherit from this method to apply extra configuration if necessary.
- Parameters:
instance- the container instance to configure.endpoint- the endpoint.
-