🔴 Redis Intermediate

What are Redis Streams?

Answer

Redis Streams (introduced in Redis 5.0) is a persistent, append-only log data structure similar to Apache Kafka, but built into Redis. Each entry has an auto-generated ID (timestamp-sequence, e.g., 1700000000000-0) and contains field-value pairs. XADD stream * field value appends an entry. XREAD COUNT 10 STREAMS stream 0 reads entries. Key features: Consumer Groups (XGROUP) allow multiple consumers to process different entries from the same stream in parallel, with acknowledgement (XACK) to track processed entries — similar to Kafka consumer groups. This enables reliable, at-least-once processing of events, overcoming the fire-and-forget limitation of Pub/Sub. Use Streams for event sourcing, activity feeds, and durable inter-service messaging within a Redis environment.