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 registeringRabbitListenerEndpoint
with aRabbitListenerEndpointRegistry
.- Since:
- 1.4
- Author:
- Stephane Nicoll, Juergen Hoeller, Artem Bilan
- See Also:
RabbitListenerConfigurer
-
-
Constructor Summary
Constructors Constructor Description RabbitListenerEndpointRegistrar()
-
Method Summary
-
-
-
Method Detail
-
setEndpointRegistry
public void setEndpointRegistry(RabbitListenerEndpointRegistry endpointRegistry)
Set theRabbitListenerEndpointRegistry
instance to use.- Parameters:
endpointRegistry
- theRabbitListenerEndpointRegistry
instance to use.
-
getEndpointRegistry
@Nullable public RabbitListenerEndpointRegistry getEndpointRegistry()
- Returns:
- the
RabbitListenerEndpointRegistry
instance for this registrar, may benull
.
-
getCustomMethodArgumentResolvers
public 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 toRabbitListenerAnnotationBeanPostProcessor
Default empty list.- Parameters:
methodArgumentResolvers
- the methodArgumentResolvers to assign.- Since:
- 2.3.7
-
setMessageHandlerMethodFactory
public void setMessageHandlerMethodFactory(MessageHandlerMethodFactory rabbitHandlerMethodFactory)
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
public MessageHandlerMethodFactory getMessageHandlerMethodFactory()
- Returns:
- the custom
MessageHandlerMethodFactory
to use, if any.
-
setContainerFactory
public void setContainerFactory(RabbitListenerContainerFactory<?> containerFactory)
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
public void setContainerFactoryBeanName(String containerFactoryBeanName)
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(org.springframework.beans.factory.BeanFactory)
-
setBeanFactory
public void setBeanFactory(BeanFactory beanFactory)
ABeanFactory
only needs to be available in conjunction withsetContainerFactoryBeanName(java.lang.String)
.- Specified by:
setBeanFactory
in interfaceBeanFactoryAware
- Parameters:
beanFactory
- theBeanFactory
instance.
-
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:
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
public void registerEndpoint(RabbitListenerEndpoint endpoint)
Register a newRabbitListenerEndpoint
using the defaultRabbitListenerContainerFactory
to create the underlying container.- Parameters:
endpoint
- theRabbitListenerEndpoint
instance to register.- See Also:
setContainerFactory(RabbitListenerContainerFactory)
,registerEndpoint(RabbitListenerEndpoint, RabbitListenerContainerFactory)
-
-