Class RedisListenerEndpointRegistrar
java.lang.Object
org.springframework.data.redis.config.RedisListenerEndpointRegistrar
- All Implemented Interfaces:
Aware, BeanFactoryAware, InitializingBean
public class RedisListenerEndpointRegistrar
extends Object
implements BeanFactoryAware, InitializingBean
Helper bean for registering
RedisListenerEndpoint instances with a RedisListenerEndpointRegistry.
Provides convenient methods to register endpoints and configure the underlying infrastructure, such as the
MessageHandlerMethodFactory and MessageConverter.
- Since:
- 4.1
- Author:
- Ilyass Bougati, Mark Paluch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidapply(List<RedisListenerConfigurer> configurers) @Nullable RedisListenerEndpointRegistryReturn theRedisListenerEndpointRegistryinstance for this registrar, may benull.Return theMessageHandlerMethodFactoryto use.protected voidRegister all queued endpoints directly with the underlying registry.voidregisterEndpoint(RedisListenerEndpoint endpoint, RedisMessageListenerContainer container) Register a newRedisListenerEndpointalongside theRedisMessageListenerContainer.voidsetBeanFactory(BeanFactory beanFactory) voidsetConversionService(@Nullable ConversionService conversionService) Set theConversionServiceto use for payload conversion.voidsetCustomArgumentResolvers(List<HandlerMethodArgumentResolver> customArgumentResolvers) Set customresolversto support custom controller method arguments.voidsetEndpointRegistry(@Nullable RedisListenerEndpointRegistry endpointRegistry) Set theRedisListenerEndpointRegistryinstance to use.voidsetMessageConverter(@Nullable MessageConverter messageConverter) Set theMessageConverterto use for payload conversion.voidsetMessageHandlerMethodFactory(@Nullable MessageHandlerMethodFactory messageHandlerMethodFactory) Set theMessageHandlerMethodFactoryto use to configure the message listener responsible to serve an endpoint detected by this processor.voidsetValidator(@Nullable Validator validator) Set theValidatorto use for payload validation.
-
Constructor Details
-
RedisListenerEndpointRegistrar
public RedisListenerEndpointRegistrar()
-
-
Method Details
-
setEndpointRegistry
Set theRedisListenerEndpointRegistryinstance to use.- Parameters:
endpointRegistry- theRedisListenerEndpointRegistry
-
getEndpointRegistry
Return theRedisListenerEndpointRegistryinstance for this registrar, may benull. -
setMessageHandlerMethodFactory
public void setMessageHandlerMethodFactory(@Nullable MessageHandlerMethodFactory messageHandlerMethodFactory) 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. -
getMessageHandlerMethodFactory
Return theMessageHandlerMethodFactoryto use.If no custom factory is set, a default one will be created based on the configured
ConversionService,MessageConverter, andValidator.- Returns:
- the
MessageHandlerMethodFactory
-
setBeanFactory
- Specified by:
setBeanFactoryin interfaceBeanFactoryAware
-
setCustomArgumentResolvers
Set customresolversto support custom controller method arguments.- Parameters:
customArgumentResolvers- the list of resolvers to configure
-
setValidator
-
setConversionService
Set theConversionServiceto use for payload conversion.- Parameters:
conversionService- theConversionServiceto configure. Can be null to use the default.
-
setMessageConverter
Set theMessageConverterto use for payload conversion.- Parameters:
messageConverter- theMessageConverterto configure
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceInitializingBean
-
registerAllEndpoints
protected void registerAllEndpoints()Register all queued endpoints directly with the underlying registry. -
registerEndpoint
public void registerEndpoint(RedisListenerEndpoint endpoint, RedisMessageListenerContainer container) Register a newRedisListenerEndpointalongside theRedisMessageListenerContainer.If the underlying
RedisListenerEndpointRegistryis already active, the endpoint is registered and started immediately. Otherwise, it is queued and registered once the registry becomes active.- Parameters:
endpoint- theRedisListenerEndpointto register
-
apply
-