You can use query_watermark_offsets() to get high watermark of the topic 
partition to use as max offset.

Regards,
Koushik
-----Original Message-----
From: Aurelien DROISSART <aurelien.droiss...@amadeus.com> 
Sent: Thursday, August 29, 2019 5:32 AM
To: users@kafka.apache.org
Subject: librdkafka : seek() to offset out of range

Hello all,

we have a question about librdkafka

- Kafka version :  2.0.1
- librdkafka version : 0.11.4

We have an application connecting to kafka using librdkafka.
It needs to consume a topic starting at a specific offset value stored in the 
application.
It does so by calling rd_kafka_seek().
In standard cases, everything is fine; however in some specific use cases, the 
value stored in our application is greater that the latest offset in kafka.
But we are not able to detect these cases as rd_kafka_seek() is not returning 
any error when it is passed out-of-range offsets.

Does anyone have experience with librdkafka and could tell how to either :
- get an error when we seek() to an out-of-range offset,
- or retrieve the max offset in kafka before performing seek()?

Thanks
Aurelien

Reply via email to