I want to get the last record offset in the topic partition. There is endOffsets
method in the consumer. And usually endOffsets - 1
works fine. But in the case of transactional producer topic may contain offsets without a records. And endOffsets - 1
will point to the offset without record. So, how should I compute the last record offset in this case?
More interestingly, what if I will have both a simple and transactional producer for my topic? Is there any reliable way to get the last record offset ignoring all this complexity?