Class RabbitListenerEndpointRegistrar
- java.lang.Object
-
- org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar
-
- All Implemented Interfaces:
Aware,BeanFactoryAware,InitializingBean
public class RabbitListenerEndpointRegistrar extends java.lang.Object implements BeanFactoryAware, InitializingBean
Helper bean for registeringRabbitListenerEndpointwith aRabbitListenerEndpointRegistry.- Since:
- 1.4
- Author:
- Stephane Nicoll, Juergen Hoeller, Artem Bilan
- See Also:
RabbitListenerConfigurer
-
-
Constructor Summary
Constructors Constructor Description RabbitListenerEndpointRegistrar()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()java.util.List<HandlerMethodArgumentResolver>getCustomMethodArgumentResolvers()Return the list ofHandlerMethodArgumentResolver.RabbitListenerEndpointRegistrygetEndpointRegistry()MessageHandlerMethodFactorygetMessageHandlerMethodFactory()ValidatorgetValidator()Get the validator, if supplied.protected voidregisterAllEndpoints()voidregisterEndpoint(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(java.lang.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.
-
-
-
Method Detail
-
setEndpointRegistry
public void setEndpointRegistry(RabbitListenerEndpointRegistry endpointRegistry)
Set theRabbitListenerEndpointRegistryinstance to use.- Parameters:
endpointRegistry- theRabbitListenerEndpointRegistryinstance to use.
-
getEndpointRegistry
@Nullable public RabbitListenerEndpointRegistry getEndpointRegistry()
- Returns:
- the
RabbitListenerEndpointRegistryinstance for this registrar, may benull.
-
getCustomMethodArgumentResolvers
public java.util.List<HandlerMethodArgumentResolver> 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
public void setMessageHandlerMethodFactory(MessageHandlerMethodFactory rabbitHandlerMethodFactory)
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
public MessageHandlerMethodFactory getMessageHandlerMethodFactory()
- Returns:
- the custom
MessageHandlerMethodFactoryto use, if any.
-
setContainerFactory
public void setContainerFactory(RabbitListenerContainerFactory<?> containerFactory)
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
public void setContainerFactoryBeanName(java.lang.String containerFactoryBeanName)
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(org.springframework.beans.factory.BeanFactory)
-
setBeanFactory
public void setBeanFactory(BeanFactory beanFactory)
ABeanFactoryonly needs to be available in conjunction withsetContainerFactoryBeanName(java.lang.String).- Specified by:
setBeanFactoryin interfaceBeanFactoryAware- Parameters:
beanFactory- theBeanFactoryinstance.
-
getValidator
@Nullable public Validator getValidator()
Get the validator, if supplied.- Returns:
- the validator.
- Since:
- 2.3.7
-
setValidator
public void setValidator(Validator validator)
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
public void registerEndpoint(RabbitListenerEndpoint endpoint)
Register a newRabbitListenerEndpointusing the defaultRabbitListenerContainerFactoryto create the underlying container.- Parameters:
endpoint- theRabbitListenerEndpointinstance to register.- See Also:
setContainerFactory(RabbitListenerContainerFactory),registerEndpoint(RabbitListenerEndpoint, RabbitListenerContainerFactory)
-
-