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 RedisKeyExpiredEvent
s via ApplicationEventPublisher
by listening
to Redis keyspace notifications for key expirations.- Since:
- 1.7
- Author:
- Christoph Strobl
-
Constructor Summary
ConstructorDescriptionKeyExpirationEventMessageListener
(RedisMessageListenerContainer listenerContainer) Creates newMessageListener
for__keyevent@*__:expired
messages. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doHandleMessage
(Message message) Handle the actual messageprotected void
doRegister
(RedisMessageListenerContainer listenerContainer) Register instance within the container.protected void
publishEvent
(RedisKeyExpiredEvent event) Publish the event in case anApplicationEventPublisher
is set.void
setApplicationEventPublisher
(ApplicationEventPublisher applicationEventPublisher) Methods inherited from class org.springframework.data.redis.listener.KeyspaceEventMessageListener
afterPropertiesSet, destroy, init, onMessage, setKeyspaceNotificationsConfigParameter
-
Constructor Details
-
KeyExpirationEventMessageListener
Creates newMessageListener
for__keyevent@*__:expired
messages.- Parameters:
listenerContainer
- must not be null.
-
-
Method Details
-
setApplicationEventPublisher
- Specified by:
setApplicationEventPublisher
in interfaceApplicationEventPublisherAware
-
doRegister
Description copied from class:KeyspaceEventMessageListener
Register instance within the container.- Overrides:
doRegister
in classKeyspaceEventMessageListener
- Parameters:
listenerContainer
- never null.
-
doHandleMessage
Description copied from class:KeyspaceEventMessageListener
Handle the actual message- Specified by:
doHandleMessage
in classKeyspaceEventMessageListener
- Parameters:
message
- never null.
-
publishEvent
Publish the event in case anApplicationEventPublisher
is set.- Parameters:
event
- can be null.
-