-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Description
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
SinuxLee
Metadata
Metadata
Assignees
Labels
No labels