Integration / Apache Kafka Interview questions
How does Kafka differ from RabbitMQ?
Both move messages between producers and consumers, but they're built around fundamentally different models — Kafka a distributed, partitioned log; RabbitMQ a traditional broker with queues and flexible routing.
| Kafka | RabbitMQ |
| Records persist in a log for a configured retention period, replayable by multiple consumers. | Messages are typically removed from a queue once acknowledged by a consumer. |
| Ordering guaranteed within a partition; scales via partitions and consumer groups. | Ordering guaranteed within a single queue; scaling often means more queues/consumers with different trade-offs. |
| Simple routing: topic name plus optional key-based partitioning. | Rich routing via exchanges (direct, topic, fanout, headers) for complex message-routing rules. |
| Optimized for very high sustained throughput and long-term retention. | Optimized for flexible, lower-latency messaging with per-message acknowledgment patterns. |
The practical rule of thumb: reach for Kafka when the core need is high-throughput event streaming, replayable history, or feeding multiple independent downstream consumers from one source; reach for RabbitMQ when the core need is flexible message routing, work-queue-style task distribution, or simpler per-message delivery guarantees without needing to retain a long history.
More Related questions...