How does Kafka differ from traditional messaging systems?

Apache Kafka is a distributed event streaming platform, whereas traditional messaging systems like ActiveMQ or RabbitMQ are built around point-to-point or publish-subscribe queues. Kafka persists every message to disk in an ordered, append-only log and lets multiple independent consumers replay that log, rather than deleting a message once it has been delivered.

Key Points: • Kafka retains messages for a configurable period (or indefinitely with compaction), so consumers can replay history; traditional brokers usually delete messages after delivery. • Kafka is built for horizontal scale via partitioned topics spread across brokers, giving much higher throughput than typical message queues. • Multiple consumer groups can independently read the same topic at their own pace, unlike a queue where a message is consumed once. • Traditional brokers often push messages to consumers; Kafka consumers pull messages and track their own offsets. • Kafka is optimized for high-volume streaming and log-based architectures, while traditional MOM systems focus on transactional, lower-volume messaging with richer routing (e.g. JMS selectors).

Example: A traditional queue-based system might route an order confirmation to exactly one order-processing service and then discard it, while Kafka would let the same order event be consumed independently by billing, inventory, and analytics services, each reading at their own pace from the same topic.

Interview Tip: A concise interview answer is:

"Kafka differs from traditional messaging systems because it stores messages as a durable, replayable log distributed across partitions, allowing many independent consumers to read the same data at high throughput, whereas traditional brokers like RabbitMQ typically deliver a message once and then discard it."