Class PartitionState<K,V>
java.lang.Object
io.confluent.parallelconsumer.state.PartitionState<K,V>
- Direct Known Subclasses:
RemovedPartitionState
public class PartitionState<K,V> extends Object
- See Also:
PartitionStateManager
-
Field Summary
Fields Modifier and Type Field Description static longKAFKA_OFFSET_ABSENCESymbolic value for a parameter which is initialised as having an offset absent (instead of using Optional or null) -
Constructor Summary
Constructors Constructor Description PartitionState(org.apache.kafka.common.TopicPartition tp, OffsetMapCodecManager.HighestOffsetAndIncompletes offsetData) -
Method Summary
Modifier and Type Method Description voidaddWorkContainer(WorkContainer<K,V> wc)Set<Long>getAllIncompleteOffsets()Optional<org.apache.kafka.clients.consumer.OffsetAndMetadata>getCommitDataIfDirty()intgetCommitQueueSize()Set<Long>getIncompleteOffsetsBelowHighestSucceeded()longgetOffsetHighestSeen()The highest seen offset for a partition.longgetOffsetHighestSequentialSucceeded()longgetOffsetHighestSucceeded()Highest offset which has completed successfully ("succeeded").org.apache.kafka.common.TopicPartitiongetTp()booleanhasWorkInCommitQueue()booleanisBlocked()Convenience method for readabilitybooleanisRecordPreviouslyCompleted(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> rec)booleanisRemoved()Has this partition been removed? No.voidonFailure(WorkContainer<K,V> work)voidonOffsetCommitSuccess(org.apache.kafka.clients.consumer.OffsetAndMetadata committed)voidonPartitionsRemoved(ShardManager<K,V> sm)voidonSuccess(WorkContainer<K,V> work)StringtoString()
-
Field Details
-
KAFKA_OFFSET_ABSENCE
public static final long KAFKA_OFFSET_ABSENCESymbolic value for a parameter which is initialised as having an offset absent (instead of using Optional or null)- See Also:
- Constant Field Values
-
-
Constructor Details
-
PartitionState
public PartitionState(org.apache.kafka.common.TopicPartition tp, OffsetMapCodecManager.HighestOffsetAndIncompletes offsetData)
-
-
Method Details
-
onOffsetCommitSuccess
public void onOffsetCommitSuccess(org.apache.kafka.clients.consumer.OffsetAndMetadata committed) -
isRecordPreviouslyCompleted
-
hasWorkInCommitQueue
public boolean hasWorkInCommitQueue() -
getCommitQueueSize
public int getCommitQueueSize() -
onSuccess
-
onFailure
-
addWorkContainer
-
isRemoved
public boolean isRemoved()Has this partition been removed? No.- Returns:
- by definition false in this implementation
-
getCommitDataIfDirty
-
getAllIncompleteOffsets
- Returns:
- all incomplete offsets of buffered work in this shard, even if higher than the highest succeeded
-
getIncompleteOffsetsBelowHighestSucceeded
- Returns:
- incomplete offsets which are lower than the highest succeeded
-
getOffsetHighestSequentialSucceeded
public long getOffsetHighestSequentialSucceeded() -
onPartitionsRemoved
-
isBlocked
public boolean isBlocked()Convenience method for readability- Returns:
- true if
isAllowedMoreRecords()is false - See Also:
isAllowedMoreRecords()
-
toString
-
getTp
public org.apache.kafka.common.TopicPartition getTp() -
getOffsetHighestSeen
public long getOffsetHighestSeen()The highest seen offset for a partition.Starts off as -1 - no data. Offsets in Kafka are never negative, so this is fine.
-
getOffsetHighestSucceeded
public long getOffsetHighestSucceeded()Highest offset which has completed successfully ("succeeded").
-