Class ApacheKafkaOffsetPosition
java.lang.Object
com.linkedin.venice.pubsub.adapter.kafka.ApacheKafkaOffsetPosition
- All Implemented Interfaces:
PubSubPosition
Offset position for Apache Kafka topics
-
Constructor Summary
ConstructorDescriptionApacheKafkaOffsetPosition
(long offset) ApacheKafkaOffsetPosition
(ByteBuffer buffer) -
Method Summary
Modifier and TypeMethodDescriptionint
comparePosition
(PubSubPosition other) long
diff
(PubSubPosition other) boolean
long
Position wrapper is used to wrap the position type and the position value.int
hashCode()
toString()
-
Constructor Details
-
ApacheKafkaOffsetPosition
public ApacheKafkaOffsetPosition(long offset) -
ApacheKafkaOffsetPosition
- 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
- Specified by:
comparePosition
in interfacePubSubPosition
- 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
- Specified by:
diff
in interfacePubSubPosition
- 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
-
equals
- Specified by:
equals
in interfacePubSubPosition
- Overrides:
equals
in classObject
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfacePubSubPosition
- Overrides:
hashCode
in classObject
-
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 interfacePubSubPosition
- Returns:
- the position wrapper
-