Apache Kafka Streaming (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What is Apache Kafka and how does it fundamentally differ from traditional message brokers (like RabbitMQ)?
junior LevelCode ExampleRabbitMQApache KafkaMicroservices
In Simple Words:
- Traditional Message Brokers (RabbitMQ, ActiveMQ):
- Built on the Smart Broker / Dumb Consumer model.
- The broker tracks which consumer has read which message, deletes messages immediately upon consumer acknowledgment, and routes via queues.
- Designed for discrete, transactional task processing.
- Apache Kafka (Distributed Commit Log):
- Built on the Dumb Broker / Smart Consumer model.
- Kafka is an append-only, distributed, partitioned commit log stored on disk.
- Messages are immutable and retained for a configurable time (e.g. 7 days) regardless of whether they have been read.
- Consumers track their own read position (offset). Multiple independent applications can read the exact same event stream at their own pace without affecting each other.
ini
RabbitMQ: Message deleted after read
[ Producer ] ---> [ Exchange ] ---> [ Queue ] ---> [ Consumer ] (Message destroyed)
Kafka: Immutable log retained on disk
[ Producer ] ---> [ Topic / Partition Log ]
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ...
^ ^
| Consumer A | Consumer B
(Offset: 2) (Offset: 6)