Module spring.data.redis
Class KeyExpirationEventMessageListener
java.lang.Object
org.springframework.data.redis.listener.KeyspaceEventMessageListener
org.springframework.data.redis.listener.KeyExpirationEventMessageListener
- All Implemented Interfaces:
Aware,DisposableBean,InitializingBean,ApplicationEventPublisherAware,MessageListener
public class KeyExpirationEventMessageListener
extends KeyspaceEventMessageListener
implements ApplicationEventPublisherAware
MessageListener publishing RedisKeyExpiredEvents via ApplicationEventPublisher by listening
to Redis keyspace notifications for key expirations.- Since:
- 1.7
- Author:
- Christoph Strobl
-
Constructor Summary
ConstructorsConstructorDescriptionKeyExpirationEventMessageListener(RedisMessageListenerContainer listenerContainer) Creates newMessageListenerfor__keyevent@*__:expiredmessages. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoHandleMessage(Message message) Handle the actual messageprotected voiddoRegister(RedisMessageListenerContainer listenerContainer) Register instance within the container.protected voidpublishEvent(RedisKeyExpiredEvent event) Publish the event in case anApplicationEventPublisheris set.voidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) Methods inherited from class org.springframework.data.redis.listener.KeyspaceEventMessageListener
afterPropertiesSet, destroy, init, onMessage, setKeyspaceNotificationsConfigParameter
-
Constructor Details
-
KeyExpirationEventMessageListener
Creates newMessageListenerfor__keyevent@*__:expiredmessages.- Parameters:
listenerContainer- must not be null.
-
-
Method Details
-
setApplicationEventPublisher
- Specified by:
setApplicationEventPublisherin interfaceApplicationEventPublisherAware
-
doRegister
Description copied from class:KeyspaceEventMessageListenerRegister instance within the container.- Overrides:
doRegisterin classKeyspaceEventMessageListener- Parameters:
listenerContainer- never null.
-
doHandleMessage
Description copied from class:KeyspaceEventMessageListenerHandle the actual message- Specified by:
doHandleMessagein classKeyspaceEventMessageListener- Parameters:
message- never null.
-
publishEvent
Publish the event in case anApplicationEventPublisheris set.- Parameters:
event- can be null.
-