A record is not removed because it was read; it is removed when the policy says so.
# 7 days (default)
retention.ms=604800000
# or by size per partition
retention.bytes=1073741824
A consumer offline for eight days on a 7-day topic
restarts to OffsetOutOfRangeException and jumps to auto.offset.reset.
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-08-11