Class BaseRabbitListenerContainerFactory<C extends MessageListenerContainer>
java.lang.Object
org.springframework.amqp.rabbit.config.BaseRabbitListenerContainerFactory<C>
- Type Parameters:
C
- the container type that the factory creates.
- All Implemented Interfaces:
RabbitListenerContainerFactory<C>
,Aware
,BeanNameAware
,ApplicationContextAware
- Direct Known Subclasses:
AbstractRabbitListenerContainerFactory
,RabbitAmqpListenerContainerFactory
,StreamRabbitListenerContainerFactory
public abstract class BaseRabbitListenerContainerFactory<C extends MessageListenerContainer>
extends Object
implements RabbitListenerContainerFactory<C>, ApplicationContextAware
Base abstract class for listener container factories.
- Since:
- 2.4
- Author:
- Gary Russell, Ngoc Nhan, Artem Bilan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyCommonOverrides
(@Nullable RabbitListenerEndpoint endpoint, C instance) abstract C
createListenerContainer
(@Nullable RabbitListenerEndpoint endpoint) Create aMessageListenerContainer
for the givenRabbitListenerEndpoint
.Advice @Nullable []
protected ApplicationContext
@Nullable String
Return a bean name of the component or null if not a bean.protected @Nullable Boolean
Return the defaultRequeueRejected.protected @Nullable Boolean
protected @Nullable Boolean
void
setAdviceChain
(Advice @Nullable ... adviceChain) void
setApplicationContext
(ApplicationContext applicationContext) void
setBeanName
(String name) void
setBeforeSendReplyPostProcessors
(MessagePostProcessor... postProcessors) Set post processors that will be applied before sending replies; added to each message listener adapter.void
setDefaultRequeueRejected
(Boolean requeueRejected) void
setMicrometerEnabled
(boolean micrometerEnabled) Set tofalse
to disable micrometer listener timers.void
setObservationEnabled
(boolean observationEnabled) Enable observation via micrometer; disables basic Micrometer timers enabled bysetMicrometerEnabled(boolean)
.void
setReplyPostProcessorProvider
(Function<@Nullable String, @Nullable ReplyPostProcessor> replyPostProcessorProvider) Set a function to provide a reply post processor; it will be used if there is no replyPostProcessor on the rabbit listener annotation.void
setReplyRecoveryCallback
(org.springframework.retry.RecoveryCallback<?> recoveryCallback) Set aRecoveryCallback
to invoke when retries are exhausted.void
setRetryTemplate
(org.springframework.retry.support.RetryTemplate retryTemplate) Set aRetryTemplate
to use when sending replies; added to each message listener adapter.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory
createListenerContainer
-
Constructor Details
-
BaseRabbitListenerContainerFactory
public BaseRabbitListenerContainerFactory()
-
-
Method Details
-
createListenerContainer
Description copied from interface:RabbitListenerContainerFactory
Create aMessageListenerContainer
for the givenRabbitListenerEndpoint
.- Specified by:
createListenerContainer
in interfaceRabbitListenerContainerFactory<C extends MessageListenerContainer>
- Parameters:
endpoint
- the endpoint to configure.- Returns:
- the created container.
-
setDefaultRequeueRejected
- Parameters:
requeueRejected
- true to reject by default.- See Also:
-
getDefaultRequeueRejected
Return the defaultRequeueRejected.- Returns:
- the defaultRequeueRejected.
-
setBeforeSendReplyPostProcessors
Set post processors that will be applied before sending replies; added to each message listener adapter.- Parameters:
postProcessors
- the post processors.- See Also:
-
setRetryTemplate
public void setRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate) Set aRetryTemplate
to use when sending replies; added to each message listener adapter.- Parameters:
retryTemplate
- the template.- See Also:
-
setReplyRecoveryCallback
public void setReplyRecoveryCallback(org.springframework.retry.RecoveryCallback<?> recoveryCallback) Set aRecoveryCallback
to invoke when retries are exhausted. Added to each message listener adapter. Only used if aretryTemplate
is provided.- Parameters:
recoveryCallback
- the recovery callback.- See Also:
-
setReplyPostProcessorProvider
public void setReplyPostProcessorProvider(Function<@Nullable String, @Nullable ReplyPostProcessor> replyPostProcessorProvider) Set a function to provide a reply post processor; it will be used if there is no replyPostProcessor on the rabbit listener annotation. The input parameter is the listener id.- Parameters:
replyPostProcessorProvider
- the post processor.- Since:
- 3.0
-
applyCommonOverrides
-
getAdviceChain
- Returns:
- the advice chain that was set. Defaults to
null
. - Since:
- 1.7.4
-
setAdviceChain
- Parameters:
adviceChain
- the advice chain to set.- See Also:
-
setMicrometerEnabled
public void setMicrometerEnabled(boolean micrometerEnabled) Set tofalse
to disable micrometer listener timers. When true, ignored ifsetObservationEnabled(boolean)
is set to true.- Parameters:
micrometerEnabled
- false to disable.- Since:
- 3.0
- See Also:
-
getMicrometerEnabled
-
setObservationEnabled
public void setObservationEnabled(boolean observationEnabled) Enable observation via micrometer; disables basic Micrometer timers enabled bysetMicrometerEnabled(boolean)
.- Parameters:
observationEnabled
- true to enable.- Since:
- 3.0
- See Also:
-
getObservationEnabled
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Throws:
BeansException
-
getApplicationContext
-
setBeanName
- Specified by:
setBeanName
in interfaceBeanNameAware
- Specified by:
setBeanName
in interfaceRabbitListenerContainerFactory<C extends MessageListenerContainer>
-
getBeanName
Description copied from interface:RabbitListenerContainerFactory
Return a bean name of the component or null if not a bean.- Specified by:
getBeanName
in interfaceRabbitListenerContainerFactory<C extends MessageListenerContainer>
- Returns:
- the bean name.
-