Description
Greg Turnquist opened DATAREDIS-428 and commented
Listener configuration in Spring Data Redis requires always to define a MessageListener
because Spring Data Redis has no built-in support for an annotation-driven configuration like it is handled JMS or AMQP. Users have to obtain/configure the RedisMessageListenerContainer
and to register their own MessageListener
. MessageListenerAdapter
leverages the requirement for a fixed method signature by allowing to pass a delegate to handle the message event but the infrastructure setup of the listener container is still necessary. Using the MessageListener
itself puts a high burden on the developer to consume events because everything is in byte[]'s. Allowing to configure a listener endpoint like it is done with JMS would lighten the load on developers. A possible improvement could look like:
public class MyListenerClass {
@RedisListener(id = "patternEndpoint", pattern = {"/topic/*", "__keyevent@*__:expired"})
void handleOnPattern(String pattern, Message message) {
// ...
}
@RedisListener(channel = "/channels/channel1")
void handleOnChannel(String channel, Message message) {
// ...
}
}
Issue Links:
- DATAREDIS-1026 Annotation-driven activation of RedisListeners for Pub/Sub
("is duplicated by") - DATAREDIS-397 Investigate creating
@RedisListener
for messaging
("supersedes")