scoder
scoder

Reputation: 2611

Kafka OffsetOutOfRangeException even for offset ID zero

My application is trying to poll the records from zero offset but I am getting below error

org.apache.kafka.clients.consumer.OffsetOutOfRangeException

I am using simple apache consumer code something like this , generally this error should come when I poll with offeset with a number and it is removed or not exisst in kafka broker.. So any Idea why this error even for offest 0

Upvotes: 0

Views: 214

Answers (1)

Mickael Maison
Mickael Maison

Reputation: 26910

As you said, this error happens when the requested offset does not exist anymore in Kafka.

Offset 0 is not different. It can be deleted like any other offset when the retention limits are reached.

You can use the Consumer's beginningOffsets() or Admin's listOffsets() APIs to find the beginning offsets for your topic.

Upvotes: 1

Related Questions