I am using kafka-node library to consume the kafka messages from node.js. This is the simple code I tried to consume:
consumer = new Consumer(
client,
[
{ topic: 't', partition: 0 }, { topic: 't1', partition: 1 }
],
{
autoCommit: false
}
);
consumer.on('message', function (message) {
console.log(message);
});
This was working perfectly sometime before, but now I keep on getting this error:
kafka.common.OffsetOutOfRangeException: Request for offset 19 but we only have log segments in the range 0 to 0.
I don't understand what makes Kafka to throw this error without any reason for the same code which was working before, I haven't given offset as 19 no where. I tried deleting the topics, logs etc. I keep on getting this error. Can anyone please guide me how to handle this?