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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Return the list ofHandlerMethodArgumentResolver
.Get the validator, if supplied.protected void
void
registerEndpoint
(RabbitListenerEndpoint endpoint) Register a newRabbitListenerEndpoint
using the defaultRabbitListenerContainerFactory
to create the underlying container.void
registerEndpoint
(RabbitListenerEndpoint endpoint, RabbitListenerContainerFactory<?> factory) Register a newRabbitListenerEndpoint
alongside theRabbitListenerContainerFactory
to use to create the underlying container.void
setBeanFactory
(BeanFactory beanFactory) ABeanFactory
only needs to be available in conjunction withsetContainerFactoryBeanName(java.lang.String)
.void
setContainerFactory
(RabbitListenerContainerFactory<?> containerFactory) Set theRabbitListenerContainerFactory
to use in case aRabbitListenerEndpoint
is registered with anull
container factory.void
setContainerFactoryBeanName
(String containerFactoryBeanName) Set the bean name of theRabbitListenerContainerFactory
to use in case aRabbitListenerEndpoint
is registered with anull
container factory.void
setCustomMethodArgumentResolvers
(HandlerMethodArgumentResolver... methodArgumentResolvers) Add custom methods arguments resolvers toRabbitListenerAnnotationBeanPostProcessor
Default empty list.void
setEndpointRegistry
(RabbitListenerEndpointRegistry endpointRegistry) Set theRabbitListenerEndpointRegistry
instance to use.void
setMessageHandlerMethodFactory
(MessageHandlerMethodFactory rabbitHandlerMethodFactory) Set theMessageHandlerMethodFactory
to use to configure the message listener responsible to serve an endpoint detected by this processor.void
setValidator
(Validator validator) Set the validator to use if the default message handler factory is used.
-
Constructor Details
-
RabbitListenerEndpointRegistrar
public RabbitListenerEndpointRegistrar()
-
-
Method Details
-
setEndpointRegistry
Set theRabbitListenerEndpointRegistry
instance to use.- Parameters:
endpointRegistry
- theRabbitListenerEndpointRegistry
instance to use.
-
getEndpointRegistry
- Returns:
- the
RabbitListenerEndpointRegistry
instance 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 toRabbitListenerAnnotationBeanPostProcessor
Default empty list.- Parameters:
methodArgumentResolvers
- the methodArgumentResolvers to assign.- Since:
- 2.3.7
-
setMessageHandlerMethodFactory
Set theMessageHandlerMethodFactory
to use to configure the message listener responsible to serve an endpoint detected by this processor.By default,
DefaultMessageHandlerMethodFactory
is used and it can be configured further to support additional method arguments or to customize conversion and validation support. SeeDefaultMessageHandlerMethodFactory
javadoc for more details.- Parameters:
rabbitHandlerMethodFactory
- theMessageHandlerMethodFactory
instance.
-
getMessageHandlerMethodFactory
- Returns:
- the custom
MessageHandlerMethodFactory
to use, if any.
-
setContainerFactory
Set theRabbitListenerContainerFactory
to use in case aRabbitListenerEndpoint
is registered with anull
container factory.Alternatively, the bean name of the
RabbitListenerContainerFactory
to use can be specified for a lazy lookup, seesetContainerFactoryBeanName(java.lang.String)
.- Parameters:
containerFactory
- theRabbitListenerContainerFactory
instance.
-
setContainerFactoryBeanName
Set the bean name of theRabbitListenerContainerFactory
to use in case aRabbitListenerEndpoint
is registered with anull
container factory. Alternatively, the container factory instance can be registered directly: seesetContainerFactory(RabbitListenerContainerFactory)
.- Parameters:
containerFactoryBeanName
- theRabbitListenerContainerFactory
bean name.- See Also:
-
setBeanFactory
ABeanFactory
only needs to be available in conjunction withsetContainerFactoryBeanName(java.lang.String)
.- Specified by:
setBeanFactory
in interfaceBeanFactoryAware
- Parameters:
beanFactory
- theBeanFactory
instance.
-
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:
afterPropertiesSet
in interfaceInitializingBean
-
registerAllEndpoints
protected void registerAllEndpoints() -
registerEndpoint
public void registerEndpoint(RabbitListenerEndpoint endpoint, @Nullable RabbitListenerContainerFactory<?> factory) Register a newRabbitListenerEndpoint
alongside theRabbitListenerContainerFactory
to use to create the underlying container.The
factory
may benull
if the default factory has to be used for that endpoint.- Parameters:
endpoint
- theRabbitListenerEndpoint
instance to register.factory
- theRabbitListenerContainerFactory
to use.
-
registerEndpoint
Register a newRabbitListenerEndpoint
using the defaultRabbitListenerContainerFactory
to create the underlying container.- Parameters:
endpoint
- theRabbitListenerEndpoint
instance to register.- See Also:
-