How to Solve Kafka Message Duplication and Loss Cases
Key point
This shares a case from Oliveyoung's OMS project where Kafka was used to prevent message duplication and loss while securing high availability.
Details
Oliveyoung completely overhauled its existing EAI and Batch-based integration approach into a Kafka-based real-time interface through the OMS (Order Management System) project. Through this, it improved throughput by up to 45x compared to before, building a stable data transmission and reception structure.
To solve the duplication and loss issues that can occur during message transmission, the following settings were applied.
-
Producer - Broker section
- Loss prevention: Message delivery is guaranteed through the
acks=alloption andretriessettings. - Duplication prevention: The
enable.idempotence=trueoption is used to ensure idempotency so that messages are stored only once even when retried due to network errors.
- Loss prevention: Message delivery is guaranteed through the
-
Consumer - Broker section
- Loss prevention: Data loss during consumer restart is prevented through
auto.offset.reset=earliestand Graceful Shutdown (immediate-stop=false) settings. - Duplication prevention: Duplicate consumption is prevented by explicitly sending an Ack after message processing is complete, through the
AcksMode=MANUAL_IMMEDIATEsetting.
- Loss prevention: Data loss during consumer restart is prevented through
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.