gofr icon indicating copy to clipboard operation
gofr copied to clipboard

Redis Pub Sub Support

Open Thomas-Matheus opened this issue 3 months ago • 1 comments

Description

Currently, GoFr provides excellent support for Redis. However, unfortunately doesn't have Redis Pub Sub support, which is essential for building event-driven architectures and real-time applications.

Adding Redis Pub/Sub native support would enable GoFr applications to easily implement asynchronous messaging without requiring additional message brokers.

Proposed Solution

  • Add built-in Redis Pub/Sub client integration to GoFr's core:
    • Native publisher interface for sending messages to channels
    • Subscriber interface with goroutine-based message handling
    • Pattern-based subscriptions (e.g., user.*, order.created)
  • Integrate with GoFr's existing Redis configuration and connection management
  • Provide middleware support for message processing (logging, metrics, error handling)
  • Support for message serialization/deserialization (JSON, protobuf, etc.)
  • Configuration through environment variables (e.g., REDIS_PUBSUB_ENABLED=true)
  • Graceful shutdown handling for active subscriptions

Use Cases

  • Real-time notifications: User activity notifications, system alerts, chat applications
  • Cache invalidation: Distributed cache invalidation across multiple service instances
  • Background job: Job queues for non-critical async tasks

Benefits

  • Consistent GoFr experience: Leverages existing Redis connection and follows GoFr patterns
  • Performance: Redis Pub/Sub is lightweight and fast for real-time messaging
  • Developer productivity: Native integration reduces boilerplate code
  • Cost-effective: Utilizes existing Redis infrastructure without additional components

Thomas-Matheus avatar Sep 25 '25 21:09 Thomas-Matheus

Thanks, @Thomas-Matheus ! We’ll definitely include this in our roadmap and will update you once the feature is approved and implemented.

coolwednesday avatar Oct 06 '25 07:10 coolwednesday