A practical deep dive into Kafka offset commit behavior with Spring Boot, demonstrating how applications can lose messages or process them multiple times. Covers three scenarios: single-thread consumption, multi-thread consumption with concurrency, and asynchronous processing via ExecutorService. Shows how graceful shutdown timeouts interact with offset commits, and how async processing can cause offsets to be committed before messages are actually processed, leading to silent message loss on restart. Includes working code examples and Docker Compose setup.

11m read timeFrom piotrminkowski.com
Post cover image
Table of contents
Source CodeHow It WorksUse Spring Boot with KafkaReceiving MessagesDuplicate Message Processing with Spring KafkaLose Messages with Spring KafkaConclusion

Sort: