Apache Kafka Streaming (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What are the three Message Delivery Semantics?
junior LevelkafkaBasic
In Simple Words:
- At-Most-Once: Messages may be lost, but are never duplicated.
- Consumer commits offset before processing message:
Fetch -> Commit Offset -> Process. If the consumer crashes during processing, the message is lost forever.
- Consumer commits offset before processing message:
- At-Least-Once (Default & Most Common): Messages are never lost, but may be duplicated.
- Consumer commits offset after successfully processing message:
Fetch -> Process -> Commit Offset. If the consumer crashes mid-processing, the replacement consumer re-reads the uncommitted message. - Requirement: Consumers must be idempotent (safe to execute multiple times).
- Consumer commits offset after successfully processing message:
- Exactly-Once Semantics (EOS): Messages are processed and committed exactly once, even during broker failures or network retries. Achieved via Kafka Transactions and idempotent producers.