spring-projects / spring-data-redis

Provides support to increase developer productivity in Java when using Redis, a key-value store. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
https://spring.io/projects/spring-data-redis/
Apache License 2.0
1.77k stars 1.17k forks source link

Why doesn’t Spring Data Redis provide annotation-based listeners for Redis Streams and Pub/Sub? #3033

Closed JiHongKim98 closed 2 weeks ago

JiHongKim98 commented 2 weeks ago

Issue Description

I'm curious why Spring Data Redis doesn’t offer an annotation-based listener mechanism for Redis Streams and Pub/Sub, similar to @KafkaListener in Spring Kafka. My thought is that having an annotation-based approach could make Redis Pub/Sub or Streams easier to use, particularly when using Redis as a messaging broker.

Example Scenario

public class SomeListenerClass {

    @RedisStreamListener(streamKey = "notification-stream")
    public void someHandleStreamMessage(MapRecord<String, String, String> message) {
        // ...
    }

    @RedisPubSubListener(channel = "alert-channel")
    public void someHandlePubSubMessage(String message) {
        // ...
    }
}

Questions

  1. Is there a specific reason why annotation-based listeners are not currently supported for Redis Streams and Pub/Sub?
  2. If not, are there any plans to introduce such functionality in future releases?
mp911de commented 2 weeks ago

This is a duplicate of #2528 and #1004.

An annotation-driven framework requires a proper configuration and argument-resolver model.