Redis Pub/Sub & Streams

Build messaging on Redis: Pub/Sub, sharded channels, keyspace events, Streams, consumer groups, XACK and XAUTOCLAIM, trimming, durability and monitoring.

Start course →

What you'll learn

  • Choose between Redis Pub/Sub, lists and Streams, and know when a dedicated broker is a better fit.
  • Use Pub/Sub, pattern and sharded subscriptions, keyspace notifications and real-time backplanes safely.
  • Model data in streams with IDs, ranges, blocking reads and trimming.
  • Process streams reliably with consumer groups, acknowledgements, pending entry recovery and dead-lettering.
  • Design job queues, outbox-driven event streams and partitioned streams for scale.
  • Operate Redis messaging with the right persistence, replication, memory sizing and monitoring.

Syllabus

Messaging with Redis

  1. Three Messaging Tools in One Server
  2. Running Redis and Using redis-cli
  3. Choosing Between Pub/Sub, Lists, Streams and a Broker

Redis Pub/Sub

  1. PUBLISH and SUBSCRIBE
  2. Pattern Subscriptions and Common Uses
  3. Limits: Slow Subscribers, Reconnects and Scale

Advanced Pub/Sub: Cluster, Keyspace Events and Real-Time Apps

  1. Sharded Pub/Sub in Redis Cluster
  2. Keyspace Notifications
  3. Scaling WebSockets and Server-Sent Events

Redis Streams Fundamentals

  1. The Stream Data Type
  2. XREAD and Blocking Reads
  3. Trimming and Memory Management

Consumer Groups

  1. Creating Groups and Reading with XREADGROUP
  2. Acknowledgements and the Pending Entries List
  3. Recovering Stuck Messages and Dead Letters

Design Patterns with Streams

  1. Job Queues: Streams vs Lists
  2. Event Streams Between Services
  3. Partitioning Streams and Ordering

Durability, Monitoring and Operations

  1. Persistence, Replication and Data Loss
  2. Monitoring Streams and Consumer Groups
  3. Memory Sizing and Performance

Clients, Comparisons and Revision

  1. Streams in Application Frameworks
  2. Redis Streams vs Kafka vs RabbitMQ
  3. Case Study: Notifications and Order Events
  4. Revision and Interview Questions