Class KeyspaceEventMessageListener
java.lang.Object
org.springframework.data.redis.listener.KeyspaceEventMessageListener
- All Implemented Interfaces:
DisposableBean,InitializingBean,MessageListener
- Direct Known Subclasses:
KeyExpirationEventMessageListener
public abstract class KeyspaceEventMessageListener
extends Object
implements MessageListener, InitializingBean, DisposableBean
Base
MessageListener implementation for listening to Redis keyspace notifications.- Since:
- 1.7
- Author:
- Christoph Strobl, Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionKeyspaceEventMessageListener(RedisMessageListenerContainer listenerContainer) Creates newKeyspaceEventMessageListener. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddestroy()protected abstract voiddoHandleMessage(Message message) Handle the actual messageprotected voiddoRegister(RedisMessageListenerContainer container) Register instance within the container.voidinit()Initialize the message listener by writing requried redis config for notify-keyspace-events and registering the listener within the container.voidCallback for processing received objects through Redis.voidsetKeyspaceNotificationsConfigParameter(String keyspaceNotificationsConfigParameter) Set the configuration string to use for notify-keyspace-events.
-
Constructor Details
-
KeyspaceEventMessageListener
Creates newKeyspaceEventMessageListener.- Parameters:
listenerContainer- must not be null.
-
-
Method Details
-
onMessage
Description copied from interface:MessageListenerCallback for processing received objects through Redis.- Specified by:
onMessagein interfaceMessageListener- Parameters:
message- message must not be null.pattern- pattern matching the channel (if specified) - can be null.
-
doHandleMessage
Handle the actual message- Parameters:
message- never null.
-
init
public void init()Initialize the message listener by writing requried redis config for notify-keyspace-events and registering the listener within the container. -
doRegister
Register instance within the container.- Parameters:
container- never null.
-
destroy
- Specified by:
destroyin interfaceDisposableBean- Throws:
Exception
-
setKeyspaceNotificationsConfigParameter
Set the configuration string to use for notify-keyspace-events.- Parameters:
keyspaceNotificationsConfigParameter- can be null.- Since:
- 1.8
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceInitializingBean- Throws:
Exception
-