1. Producer
- Sends records (messages) to Kafka
- Chooses:
- Topic
- Partition (explicitly or via key hashing)
- Can send:
- Fire-and-forget
- Synchronous
- Asynchronous (with callback)
Producer → Topic → Partition
2. Topic
- Logical channel
- Data is not updated or deleted (only compacted or expired)
order-events
payment-events
user-login-events
3. Partition
- Like subdivision of topic
- Allows parallel processing and scalability.
- Each partition is an ordered log
- Messages in a partition are ordered by offset
Topic: order-events
├──Partition0 (offset 0, 1, 2 …)
├──Partition1
⚠️ Ordering is guaranteed only within a partition