Message queues let services talk asynchronously — a producer drops a message and moves on, while a consumer processes it later. This decouples systems and absorbs traffic spikes. RabbitMQ and Kafka are the two giants, and they're built for different jobs.
RabbitMQ: The Task Queue
- A traditional broker: messages are pushed to consumers and removed once acknowledged.
- Rich routing (exchanges, topics) for complex delivery rules.
- Perfect for background jobs: emails, image processing, order fulfillment.
Kafka: The Event Log
- A distributed, append-only log; consumers read at their own pace and can replay history.
- Enormous throughput for streaming analytics, event sourcing, and data pipelines.
- Messages are retained, not deleted on consumption — multiple consumers, multiple views.
How to Choose
Need to run discrete background tasks reliably? RabbitMQ (or a simple Redis/SQS queue). Need to stream and replay high-volume events to many consumers? Kafka. Don't reach for Kafka's complexity if a task queue is all you need.
Start Simpler
For many apps, a managed queue (AWS SQS) or a database-backed job queue (Laravel Queues, BullMQ) is enough. Adopt Kafka when streaming scale genuinely demands it.
