Class OffsetSpec
java.lang.Object
org.apache.kafka.clients.admin.OffsetSpec
- Direct Known Subclasses:
OffsetSpec.EarliestLocalSpec,OffsetSpec.EarliestPendingUploadSpec,OffsetSpec.EarliestSpec,OffsetSpec.LatestSpec,OffsetSpec.LatestTieredSpec,OffsetSpec.MaxTimestampSpec,OffsetSpec.TimestampSpec
This class allows to specify the desired offsets when using
KafkaAdminClient.listOffsets(Map, ListOffsetsOptions)Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classConstructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionstatic OffsetSpecearliest()Used to retrieve the earliest offset of a partitionstatic OffsetSpecUsed to retrieve the local log start offset.static OffsetSpecUsed to retrieve the earliest offset of records that are pending upload to remote storage.static OffsetSpecforTimestamp(long timestamp) Used to retrieve the earliest offset whose timestamp is greater than or equal to the given timestamp in the corresponding partitionstatic OffsetSpeclatest()Used to retrieve the latest offset of a partitionstatic OffsetSpecUsed to retrieve the highest offset of data stored in remote storage.static OffsetSpecUsed to retrieve the offset with the largest timestamp of a partition as message timestamps can be specified client side this may not match the log end offset returned by LatestSpec
Constructor Details
OffsetSpec
public OffsetSpec()
Method Details
latest
Used to retrieve the latest offset of a partitionearliest
Used to retrieve the earliest offset of a partitionforTimestamp
Used to retrieve the earliest offset whose timestamp is greater than or equal to the given timestamp in the corresponding partition- Parameters:
timestamp- in milliseconds
maxTimestamp
Used to retrieve the offset with the largest timestamp of a partition as message timestamps can be specified client side this may not match the log end offset returned by LatestSpecearliestLocal
Used to retrieve the local log start offset. Local log start offset is the offset of a log above which reads are guaranteed to be served from the disk of the leader broker.
Note: When tiered Storage is not enabled, it behaves the same as retrieving the earliest timestamp offset.latestTiered
Used to retrieve the highest offset of data stored in remote storage.
Note: When tiered storage is not enabled, we will return unknown offset.earliestPendingUpload
Used to retrieve the earliest offset of records that are pending upload to remote storage.
Note: When tiered storage is not enabled, we will return unknown offset.