Class ApacheKafkaOffsetPosition

java.lang.Object
com.linkedin.venice.pubsub.adapter.kafka.ApacheKafkaOffsetPosition
All Implemented Interfaces:
PubSubPosition

public class ApacheKafkaOffsetPosition extends Object implements PubSubPosition
Offset position for Apache Kafka topics
  • Constructor Details

    • ApacheKafkaOffsetPosition

      public ApacheKafkaOffsetPosition(long offset)
    • ApacheKafkaOffsetPosition

      public ApacheKafkaOffsetPosition(ByteBuffer buffer) throws IOException
      Parameters:
      buffer - the buffer to read from. The ByteBuffer expected to contain avro serialized long
      Throws:
      IOException - if the buffer is not a valid avro serialized long
  • Method Details

    • comparePosition

      public int comparePosition(PubSubPosition other)
      Specified by:
      comparePosition in interface PubSubPosition
      Parameters:
      other - the other position to compare to
      Returns:
      returns 0 if the positions are equal, -1 if this position is less than the other position, and 1 if this position is greater than the other position
    • diff

      public long diff(PubSubPosition other)
      Specified by:
      diff in interface PubSubPosition
      Returns:
      the difference between this position and the other position
      Throws:
      IllegalArgumentException - if position is null or positions are not comparable
    • getOffset

      public long getOffset()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object other)
      Specified by:
      equals in interface PubSubPosition
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface PubSubPosition
      Overrides:
      hashCode in class Object
    • getPositionWireFormat

      public PubSubPositionWireFormat getPositionWireFormat()
      Position wrapper is used to wrap the position type and the position value. This is used to serialize and deserialize the position object when sending and receiving it over the wire.
      Specified by:
      getPositionWireFormat in interface PubSubPosition
      Returns:
      the position wrapper