Delivery guarantees in Kafka (at-most-once, at-least-once, exactly-once) and message order
sobes.tech AI
Answer from AI
Kafka has three main message delivery guarantee models:
-
At-most-once: A message may be delivered 0 or 1 times. Message loss is possible, but duplicates are excluded. Usually achieved by disabling retries.
-
At-least-once: A message is guaranteed to be delivered, but may be delivered multiple times (duplicates possible). This is the standard mode of Kafka operation with acknowledgment.
-
Exactly-once: A message is delivered and processed exactly once. In Kafka, this is achieved using idempotent producers and transactions, starting from version 0.11.
Message order: Kafka guarantees the order of messages within a single partition of a topic. If a topic has multiple partitions, the order between them is not guaranteed.
Example: if a producer sends messages to a single partition, the consumer will receive them in the same order. If messages are distributed across different partitions, the order may be broken.