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>,Aware,ApplicationContextAware,ApplicationEventPublisherAware
- Direct Known Subclasses:
DirectRabbitListenerContainerFactory,SimpleRabbitListenerContainerFactory
public abstract class AbstractRabbitListenerContainerFactory<C extends AbstractMessageListenerContainer>
extends BaseRabbitListenerContainerFactory<C>
implements ApplicationContextAware, ApplicationEventPublisherAware
RabbitListenerContainerFactory
for Spring's base container implementation.- Since:
- 1.4
- Author:
- Stephane Nicoll, Gary Russell, Artem Bilan, Joris Kuipers
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract CCreate an empty container instance.Create aMessageListenerContainerfor the givenRabbitListenerEndpoint.protected voidinitializeContainer(C instance, RabbitListenerEndpoint endpoint) Further initialize the specified container.voidsetAcknowledgeMode(AcknowledgeMode acknowledgeMode) voidsetAfterReceivePostProcessors(MessagePostProcessor... postProcessors) Set post processors which will be applied after the Message is received.voidsetApplicationContext(ApplicationContext applicationContext) voidsetApplicationEventPublisher(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(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(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(MessageConverter messageConverter) voidsetMismatchedQueuesFatal(Boolean mismatchedQueuesFatal) voidsetMissingQueuesFatal(Boolean missingQueuesFatal) voidsetPhase(int phase) voidsetPrefetchCount(Integer prefetch) voidsetRecoveryBackOff(BackOff recoveryBackOff) voidsetRecoveryInterval(Long recoveryInterval) voidsetTaskExecutor(Executor taskExecutor) voidsetTransactionManager(PlatformTransactionManager transactionManager) Methods inherited from class org.springframework.amqp.rabbit.config.BaseRabbitListenerContainerFactory
applyCommonOverrides, getAdviceChain, getDefaultRequeueRejected, setAdviceChain, 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
-
counter
-
-
Constructor Details
-
AbstractRabbitListenerContainerFactory
public AbstractRabbitListenerContainerFactory()
-
-
Method Details
-
setConnectionFactory
- Parameters:
connectionFactory- The connection factory.- See Also:
-
setErrorHandler
- Parameters:
errorHandler- The error handler.- See Also:
-
setMessageConverter
- Parameters:
messageConverter- the message converter to use- See Also:
-
setAcknowledgeMode
- 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
- Parameters:
transactionManager- thePlatformTransactionManagerto use.- See Also:
-
setPrefetchCount
- Parameters:
prefetch- the prefetch count- See Also:
-
setRecoveryInterval
- Parameters:
recoveryInterval- The recovery interval.- See Also:
-
setRecoveryBackOff
- 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
- Parameters:
consumerTagStrategy- the consumerTagStrategy to set- See Also:
-
setIdleEventInterval
How often to publish idle container events.- Parameters:
idleEventInterval- the interval.
-
setFailedDeclarationRetryInterval
-
setApplicationEventPublisher
- Specified by:
setApplicationEventPublisherin interfaceApplicationEventPublisherAware
-
setApplicationContext
- Specified by:
setApplicationContextin interfaceApplicationContextAware- Throws:
BeansException
-
setAutoStartup
- Parameters:
autoStartup- true for auto startup.- See Also:
-
setPhase
public void setPhase(int phase) - Parameters:
phase- The phase.- See Also:
-
setAfterReceivePostProcessors
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.
-