Skip to Content

Decouple producers from consumers and smooth traffic spikes.

Data Flow

producer --> broker --> consumer(s)

Kafka (log-based):     partition 0 .. partition 1 .. partition 2
                       each event has offset; consumers track their own

RabbitMQ / SQS (queue-based):
                       producer -> exchange -> queue -> consumer
                       message removed after ACK

Two models

Pitfalls

Analogy

A mailbox at a post office — one slot holds the next letter until the postman picks it up.

Interview tip: Specify delivery semantics — at-most-once, at-least-once, exactly-once — and how you achieve them.

Advertisement