Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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
public class OffsetAndMetadata {
 
  // This class fieldwill encodesencode leader_epoch and partition_epoch. UserIt shouldcan notbe needevolved to interpret this value.
  private final OffsetEpoch offsetEpoch;
 
  ... 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, OffsetEpoch offsetEpoch);
 
  public OffsetEpoch offsetEpoch();
 
  public long offset();
 
}


2) Add the following methods to the interface org.apache.kafka.clients.consumer.Consumer

...