Advertisement
Beginner Redis, Redis as a Message Queue

What options does Redis offer for implementing a message queue, and how do they differ from each other?

Short answer

Redis offers simple lists combined with LPUSH and BRPOP for a basic first in first out queue, Pub/Sub for real time fire and forget messaging without persistence, and Streams for a more robust, log based messaging system with persistence, consumer groups, and message…

Save Redis mock interview
Advertisement
AModel answer
Redis offers simple lists combined with LPUSH and BRPOP for a basic first in first out queue, Pub/Sub for real time fire and forget messaging without persistence, and Streams for a more robust, log based messaging system with persistence, consumer groups, and message acknowledgment, each suited to different reliability and complexity needs.
Example

-- Simple list based queue LPUSH tasks 'process_order_123' BRPOP tasks 30

Real-world example
A small internal tool uses a simple Redis list as a lightweight task queue, while a larger, more critical order processing system uses Redis Streams for the stronger delivery guarantees it needs.
Likely follow-ups
  • Which of these three approaches offers the strongest delivery guarantees?
  • How do you decide which approach is right for a specific use case?
Related topics