...
Consumer API
1) Create new class OffsetEpoch and OffsetAndOffsetEpoch
We can evolve the OffsetEpoch class as needed to encode more information. This should only be used by Kafka client implementation and user should not need to interpret its value.
Code Block |
---|
Code Block |
// This class will encode leader_epoch and partition_epoch. It can be evolved to encode more information in the future. public class OffsetEpoch { static OffsetEpoch decode(byte[]); public byte[] encode(); public String toString(); public int partitionEpoch(); public int leaderEpoch(); public OffsetEpoch(int partitionEpoch, int leaderEpoch); } public class OffsetAndOffsetEpoch { public OffsetAndOffsetEpoch(long offset, OffsetEpochbyte[] offsetEpoch); public OffsetEpochbyte[] offsetEpoch(); public long offset(); } |
...
Code Block |
---|
void seek(TopicPartition partition, long offset, OffsetEpochbyte[] offsetEpoch); OffsetAndMetadataOffsetAndOffsetEpoch positionAndOffsetEpoch(TopicPartition partition); |
...
Code Block |
---|
public class OffsetAndMetadata { // This field encodes leader_epoch and partition_epoch. User should not need to interpret this value. private final OffsetEpochbyte[] offsetEpoch; ... } public class OffsetAndTimestamp { // This field encodes leader_epoch and partition_epoch. User should not need to interpret this value. private final OffsetEpochbyte[] offsetEpoch; ... } |
4) Add new Error INVALID_PARTITION_EPOCH
...
Code Block |
---|
public class InvalidPartitionEpochException {
InvalidPartitionEpochException(Map<TopicPartition, Long> invalidPartitionEpochs)
} |
...