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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract C
Create an empty container instance.Create aMessageListenerContainer
for the givenRabbitListenerEndpoint
.protected void
initializeContainer
(C instance, RabbitListenerEndpoint endpoint) Further initialize the specified container.void
setAcknowledgeMode
(AcknowledgeMode acknowledgeMode) void
setAfterReceivePostProcessors
(MessagePostProcessor... postProcessors) Set post processors which will be applied after the Message is received.void
setApplicationEventPublisher
(ApplicationEventPublisher applicationEventPublisher) void
setAutoStartup
(Boolean autoStartup) void
setBatchingStrategy
(BatchingStrategy batchingStrategy) Set aBatchingStrategy
to use when debatching messages.void
setBatchListener
(boolean isBatch) Set to true to receive a list of debatched messages that were created by aBatchingRabbitTemplate
.void
setChannelTransacted
(Boolean channelTransacted) void
setConnectionFactory
(ConnectionFactory connectionFactory) void
setConsumerTagStrategy
(ConsumerTagStrategy consumerTagStrategy) void
setContainerCustomizer
(ContainerCustomizer<C> containerCustomizer) Set aContainerCustomizer
that is invoked after a container is created and configured to enable further customization of the container.void
setDeBatchingEnabled
(Boolean deBatchingEnabled) Determine whether or not the container should de-batch batched messages (true) or call the listener with the batch (false).void
setErrorHandler
(ErrorHandler errorHandler) void
setFailedDeclarationRetryInterval
(Long failedDeclarationRetryInterval) void
setGlobalQos
(boolean globalQos) Apply prefetch to the entire channel.void
setIdleEventInterval
(Long idleEventInterval) How often to publish idle container events.void
setMessageAckListener
(MessageAckListener messageAckListener) Set aMessageAckListener
to use when ack a message(messages) inAcknowledgeMode.AUTO
mode.void
setMessageConverter
(MessageConverter messageConverter) void
setMismatchedQueuesFatal
(Boolean mismatchedQueuesFatal) void
setMissingQueuesFatal
(Boolean missingQueuesFatal) void
setObservationConvention
(RabbitListenerObservationConvention observationConvention) Set an observation convention; used to add additional key/values to observations.void
setPhase
(int phase) void
setPrefetchCount
(Integer prefetch) void
setRecoveryBackOff
(BackOff recoveryBackOff) void
setRecoveryInterval
(Long recoveryInterval) void
setTaskExecutor
(Executor taskExecutor) void
setTransactionManager
(PlatformTransactionManager transactionManager) Methods inherited from class org.springframework.amqp.rabbit.config.BaseRabbitListenerContainerFactory
applyCommonOverrides, getAdviceChain, getApplicationContext, getDefaultRequeueRejected, getMicrometerEnabled, getObservationEnabled, setAdviceChain, setApplicationContext, setBeforeSendReplyPostProcessors, setDefaultRequeueRejected, setMicrometerEnabled, setObservationEnabled, setReplyPostProcessorProvider, setReplyRecoveryCallback, setRetryTemplate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContext
Methods 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
- theExecutor
to use.- See Also:
-
setTransactionManager
- Parameters:
transactionManager
- thePlatformTransactionManager
to 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:
setApplicationEventPublisher
in interfaceApplicationEventPublisherAware
-
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 aContainerCustomizer
that 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 aBatchingStrategy
to 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)
-
setMessageAckListener
Set aMessageAckListener
to use when ack a message(messages) inAcknowledgeMode.AUTO
mode.- Parameters:
messageAckListener
- the messageAckListener.- Since:
- 2.4.6
-
setObservationConvention
Set an observation convention; used to add additional key/values to observations.- Parameters:
observationConvention
- the convention.- Since:
- 3.0
-
createListenerContainer
Description copied from interface:RabbitListenerContainerFactory
Create aMessageListenerContainer
for the givenRabbitListenerEndpoint
.- Specified by:
createListenerContainer
in interfaceRabbitListenerContainerFactory<C extends AbstractMessageListenerContainer>
- Specified by:
createListenerContainer
in 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.
-