Course contentsShow
← System Design
Lesson 698 of 1,91919. Event Streaming PlatformsFree lesson

Streaming vs Message Queues

Key differences: message queues delete after consumption, streams persist; queues are task-oriented, streams data-oriented.

Streaming vs Message Queues

What you'll learn: How event streaming platforms fundamentally differ from traditional message queues in data lifecycle and purpose.

The Core Difference

While both message queues and event streams enable asynchronous communication between services, they serve different purposes and handle data differently.

Message queues are task-oriented. They're designed to distribute work among consumers. Once a consumer processes a message and acknowledges it, the message is deleted from the queue. Think of it like a to-do list: you complete a task, check it off, and it's gone forever.

Event streams are data-oriented. They're designed to capture and preserve sequences of events over time. Messages persist in the stream even after consumers read them, allowing multiple consumers to read the same data, replay history, or join later and catch up. Think of it like a newspaper archive: multiple people can read the same edition, and you can always go back to review old issues.

Key Distinctions

Persistence:

  • Queues: Messages deleted after successful consumption
  • Streams: Events retained according to retention policy (hours, days, or indefinitely)

Consumption Model:

  • Queues: Competing consumers—each message delivered to one consumer
  • Streams: Each consumer maintains its own position; multiple consumers can read the same events independently

Purpose:

  • Queues: Task distribution and work execution ("do this thing")
  • Streams: Event capture and data integration ("this thing happened")

Replay:

  • Queues: No replay—once consumed, data is gone
  • Streams: Full replay capability—reprocess from any point in time

Key Takeaway: Message queues excel at distributing tasks that should be processed once and forgotten, while event streams excel at capturing data history that multiple systems need to process or reprocess independently.