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
,ApplicationContextAware
- Direct Known Subclasses:
AbstractRabbitListenerContainerFactory
,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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyCommonOverrides
(RabbitListenerEndpoint endpoint, C instance) abstract C
Create aMessageListenerContainer
for the givenRabbitListenerEndpoint
.Advice[]
protected ApplicationContext
protected Boolean
Return the defaultRequeueRejected.protected Boolean
protected Boolean
void
setAdviceChain
(Advice... adviceChain) void
setApplicationContext
(ApplicationContext applicationContext) 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 to false to disable micrometer listener timers.void
setObservationEnabled
(boolean observationEnabled) Enable observation via micrometer; disables basic Micrometer timers enabled bysetMicrometerEnabled(boolean)
.void
setReplyPostProcessorProvider
(Function<String, 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<String, 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 to false 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
-