What are topics, partitions and offsets?
A topic is a named stream of messages. It is split into partitions, each an ordered, append-only log stored on the brokers. An offset is a message's position within its partition, and consumers track how far they have read by offset.
Partitions are how Kafka scales: different partitions live on different brokers and are read in parallel by different consumers. Messages are kept for the configured retention period whether or not they have been read.
Saying Kafka guarantees ordering across a whole topic. Ordering is guaranteed only within a single partition.
- How do you choose the number of partitions?
- What happens to messages after they are consumed?