Class RedisListenerAnnotationBeanPostProcessor
java.lang.Object
org.springframework.data.redis.annotation.RedisListenerAnnotationBeanPostProcessor
- All Implemented Interfaces:
Aware, BeanFactoryAware, BeanPostProcessor, SmartInitializingSingleton, Ordered
public class RedisListenerAnnotationBeanPostProcessor
extends Object
implements BeanPostProcessor, BeanFactoryAware, Ordered, SmartInitializingSingleton
Bean post-processor that registers methods annotated with
RedisListener to be subscribed to a Redis message
listener container according to the attributes of the annotation.
Annotated methods can use flexible arguments as defined by RedisListener.
This post-processor is automatically registered by Spring's by the EnableRedisListeners annotation.
See the EnableRedisListeners javadocs for complete usage details.
- Since:
- 4.1
- Author:
- Ilyass Bougati, Mark Paluch, Christoph Strobl
- See Also:
-
Field Summary
FieldsFields inherited from interface Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateEndpoint(RedisListener redisListener, Method method, Object bean) intgetOrder()protected RedisMessageListenerContainergetRedisMessageListenerContainer(RedisListener redisListener, Method method) postProcessAfterInitialization(Object bean, String beanName) protected voidprocessRedisListener(RedisListener redisListener, Method method, Object bean) Process the givenRedisListenerannotation on the given method, registering a corresponding endpoint for the given bean instance.voidsetBeanFactory(BeanFactory beanFactory) Making aBeanFactoryavailable is optional; if not set,endpoint registryhas to be explicitly configured.voidsetEndpointRegistry(@Nullable RedisListenerEndpointRegistry endpointRegistry) Set theRedisListenerEndpointRegistrythat will hold the created endpoint.voidsetMessageHandlerMethodFactory(MessageHandlerMethodFactory messageHandlerMethodFactory) Set theMessageHandlerMethodFactoryto use to configure the message listener responsible to serve an endpoint detected by this processor.voidsetOrder(int order) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BeanPostProcessor
postProcessBeforeInitialization
-
Field Details
-
logger
protected final org.apache.commons.logging.Log logger
-
-
Constructor Details
-
RedisListenerAnnotationBeanPostProcessor
public RedisListenerAnnotationBeanPostProcessor()
-
-
Method Details
-
getOrder
-
setOrder
public void setOrder(int order) -
setEndpointRegistry
Set theRedisListenerEndpointRegistrythat will hold the created endpoint. -
setMessageHandlerMethodFactory
Set theMessageHandlerMethodFactoryto use to configure the message listener responsible to serve an endpoint detected by this processor.By default,
DefaultMessageHandlerMethodFactoryis used. It can be configured further to support additional method arguments or to customize conversion and validation support. SeeDefaultMessageHandlerMethodFactoryJavadoc for more details. -
setBeanFactory
Making aBeanFactoryavailable is optional; if not set,endpoint registryhas to be explicitly configured.- Specified by:
setBeanFactoryin interfaceBeanFactoryAware
-
afterSingletonsInstantiated
public void afterSingletonsInstantiated()- Specified by:
afterSingletonsInstantiatedin interfaceSmartInitializingSingleton
-
postProcessAfterInitialization
- Specified by:
postProcessAfterInitializationin interfaceBeanPostProcessor
-
processRedisListener
Process the givenRedisListenerannotation on the given method, registering a corresponding endpoint for the given bean instance.- Parameters:
redisListener- the annotation to processmethod- the annotated methodbean- the instance to invoke the method on
-
getRedisMessageListenerContainer
protected RedisMessageListenerContainer getRedisMessageListenerContainer(RedisListener redisListener, Method method) -
createEndpoint
public MethodRedisListenerEndpoint createEndpoint(RedisListener redisListener, Method method, Object bean)
-