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>,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
AbstractRabbitListenerContainerFactory
public abstract class BaseRabbitListenerContainerFactory<C extends MessageListenerContainer>
extends Object
implements RabbitListenerContainerFactory<C>, org.springframework.context.ApplicationContextAware
Base abstract class for listener container factories.
- Since:
- 2.4
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyCommonOverrides(RabbitListenerEndpoint endpoint, C instance) abstract CCreate aMessageListenerContainerfor the givenRabbitListenerEndpoint.org.aopalliance.aop.Advice[]protected org.springframework.context.ApplicationContextprotected BooleanReturn the defaultRequeueRejected.protected Booleanprotected BooleanvoidsetAdviceChain(org.aopalliance.aop.Advice... adviceChain) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetBeforeSendReplyPostProcessors(org.springframework.amqp.core.MessagePostProcessor... postProcessors) Set post processors that will be applied before sending replies; added to each message listener adapter.voidsetDefaultRequeueRejected(Boolean requeueRejected) voidsetMicrometerEnabled(boolean micrometerEnabled) Set to false to disable micrometer listener timers.voidsetObservationEnabled(boolean observationEnabled) Enable observation via micrometer; disables basic Micrometer timers enabled bysetMicrometerEnabled(boolean).voidsetReplyPostProcessorProvider(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.voidsetReplyRecoveryCallback(org.springframework.retry.RecoveryCallback<?> recoveryCallback) Set aRecoveryCallbackto invoke when retries are exhausted.voidsetRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate) Set aRetryTemplateto 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, waitMethods inherited from interface org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory
createListenerContainer
-
Constructor Details
-
BaseRabbitListenerContainerFactory
public BaseRabbitListenerContainerFactory()
-
-
Method Details
-
createListenerContainer
Description copied from interface:RabbitListenerContainerFactoryCreate aMessageListenerContainerfor the givenRabbitListenerEndpoint.- Specified by:
createListenerContainerin 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
public void setBeforeSendReplyPostProcessors(org.springframework.amqp.core.MessagePostProcessor... postProcessors) 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 aRetryTemplateto 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 aRecoveryCallbackto invoke when retries are exhausted. Added to each message listener adapter. Only used if aretryTemplateis 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
@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:
-
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
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
-
getApplicationContext
protected org.springframework.context.ApplicationContext getApplicationContext()
-