Class RabbitListenerEndpointRegistrar
java.lang.Object
org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar
- All Implemented Interfaces:
Aware,BeanFactoryAware,InitializingBean
public class RabbitListenerEndpointRegistrar
extends Object
implements BeanFactoryAware, InitializingBean
Helper bean for registering
RabbitListenerEndpoint with
a RabbitListenerEndpointRegistry.- Since:
- 1.4
- Author:
- Stephane Nicoll, Juergen Hoeller, Artem Bilan
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidReturn the list ofHandlerMethodArgumentResolver.Get the validator, if supplied.protected voidvoidregisterEndpoint(RabbitListenerEndpoint endpoint) Register a newRabbitListenerEndpointusing the defaultRabbitListenerContainerFactoryto create the underlying container.voidregisterEndpoint(RabbitListenerEndpoint endpoint, RabbitListenerContainerFactory<?> factory) Register a newRabbitListenerEndpointalongside theRabbitListenerContainerFactoryto use to create the underlying container.voidsetBeanFactory(BeanFactory beanFactory) ABeanFactoryonly needs to be available in conjunction withsetContainerFactoryBeanName(java.lang.String).voidsetContainerFactory(RabbitListenerContainerFactory<?> containerFactory) Set theRabbitListenerContainerFactoryto use in case aRabbitListenerEndpointis registered with anullcontainer factory.voidsetContainerFactoryBeanName(String containerFactoryBeanName) Set the bean name of theRabbitListenerContainerFactoryto use in case aRabbitListenerEndpointis registered with anullcontainer factory.voidsetCustomMethodArgumentResolvers(HandlerMethodArgumentResolver... methodArgumentResolvers) Add custom methods arguments resolvers toRabbitListenerAnnotationBeanPostProcessorDefault empty list.voidsetEndpointRegistry(RabbitListenerEndpointRegistry endpointRegistry) Set theRabbitListenerEndpointRegistryinstance to use.voidsetMessageHandlerMethodFactory(MessageHandlerMethodFactory rabbitHandlerMethodFactory) Set theMessageHandlerMethodFactoryto use to configure the message listener responsible to serve an endpoint detected by this processor.voidsetValidator(Validator validator) Set the validator to use if the default message handler factory is used.
-
Constructor Details
-
RabbitListenerEndpointRegistrar
public RabbitListenerEndpointRegistrar()
-
-
Method Details
-
setEndpointRegistry
Set theRabbitListenerEndpointRegistryinstance to use.- Parameters:
endpointRegistry- theRabbitListenerEndpointRegistryinstance to use.
-
getEndpointRegistry
- Returns:
- the
RabbitListenerEndpointRegistryinstance for this registrar, may benull.
-
getCustomMethodArgumentResolvers
Return the list ofHandlerMethodArgumentResolver.- Returns:
- the list of
HandlerMethodArgumentResolver. - Since:
- 2.3.7
-
setCustomMethodArgumentResolvers
public void setCustomMethodArgumentResolvers(HandlerMethodArgumentResolver... methodArgumentResolvers) Add custom methods arguments resolvers toRabbitListenerAnnotationBeanPostProcessorDefault empty list.- Parameters:
methodArgumentResolvers- the methodArgumentResolvers to assign.- Since:
- 2.3.7
-
setMessageHandlerMethodFactory
Set theMessageHandlerMethodFactoryto use to configure the message listener responsible to serve an endpoint detected by this processor.By default,
DefaultMessageHandlerMethodFactoryis used and it can be configured further to support additional method arguments or to customize conversion and validation support. SeeDefaultMessageHandlerMethodFactoryjavadoc for more details.- Parameters:
rabbitHandlerMethodFactory- theMessageHandlerMethodFactoryinstance.
-
getMessageHandlerMethodFactory
- Returns:
- the custom
MessageHandlerMethodFactoryto use, if any.
-
setContainerFactory
Set theRabbitListenerContainerFactoryto use in case aRabbitListenerEndpointis registered with anullcontainer factory.Alternatively, the bean name of the
RabbitListenerContainerFactoryto use can be specified for a lazy lookup, seesetContainerFactoryBeanName(java.lang.String).- Parameters:
containerFactory- theRabbitListenerContainerFactoryinstance.
-
setContainerFactoryBeanName
Set the bean name of theRabbitListenerContainerFactoryto use in case aRabbitListenerEndpointis registered with anullcontainer factory. Alternatively, the container factory instance can be registered directly: seesetContainerFactory(RabbitListenerContainerFactory).- Parameters:
containerFactoryBeanName- theRabbitListenerContainerFactorybean name.- See Also:
-
setBeanFactory
ABeanFactoryonly needs to be available in conjunction withsetContainerFactoryBeanName(java.lang.String).- Specified by:
setBeanFactoryin interfaceBeanFactoryAware- Parameters:
beanFactory- theBeanFactoryinstance.
-
getValidator
Get the validator, if supplied.- Returns:
- the validator.
- Since:
- 2.3.7
-
setValidator
Set the validator to use if the default message handler factory is used.- Parameters:
validator- the validator.- Since:
- 2.3.7
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceInitializingBean
-
registerAllEndpoints
protected void registerAllEndpoints() -
registerEndpoint
public void registerEndpoint(RabbitListenerEndpoint endpoint, @Nullable RabbitListenerContainerFactory<?> factory) Register a newRabbitListenerEndpointalongside theRabbitListenerContainerFactoryto use to create the underlying container.The
factorymay benullif the default factory has to be used for that endpoint.- Parameters:
endpoint- theRabbitListenerEndpointinstance to register.factory- theRabbitListenerContainerFactoryto use.
-
registerEndpoint
Register a newRabbitListenerEndpointusing the defaultRabbitListenerContainerFactoryto create the underlying container.- Parameters:
endpoint- theRabbitListenerEndpointinstance to register.- See Also:
-