ਕਾਫਕਾ ਵੱਖ-ਵੱਖ delivery guarantees ਲਈ ਸਪੋਰਟ ਕਰਦਾ ਹੈ — at-most-once, at-least-once, ਅਤੇ exactly-once — ਜੋ ਇਹ ਨਿਰਧਾਰਤ ਕਰਦੇ ਹਨ ਕਿ ਕੀ ਮੈਸੇਜ ਖਤਮ ਜਾਂ ਡੁਪਲੀਕੇਟ ਹੋ ਸਕਦੇ ਹਨ। ਇਨ੍ਹਾਂ ਨੂੰ ਸਮਝਣਾ ਅਤੇ ਉਨ੍ਹਾਂ ਨੂੰ ਪ੍ਰਾਪਤ ਕਰਨਾ ਕਿਵੇਂ ਹੈ ਇਹ ਭਰੋਸੇਮੰਦ ਸਿਸਟਮ ਬਣਾਉਣ ਲਈ ਮਹੱਤਵਪੂਰਣ ਹੈ।
ਤਿੰਨ ਡਿਲਿਵਰੀ ਸੇਮੈਂਟਿਕਸ
AT-MOST-ONCE → messages may be LOST but never duplicated:
→ commit offset BEFORE processing → if processing fails, the message is skipped (lost)
→ for: when occasional loss is acceptable and duplicates are not (rare)
AT-LEAST-ONCE → messages are never lost but may be DUPLICATED:
→ commit offset AFTER processing → if a crash occurs before commit, the message is
reprocessed (duplicate) → requires IDEMPOTENT processing
→ the common default; safe (no loss) but handle duplicates
EXACTLY-ONCE → each message is processed exactly once (no loss, no duplicates):
→ the strongest, but hardest; requires Kafka transactions + idempotent producers
