Class PartitionState<K,V>
java.lang.Object
io.confluent.parallelconsumer.state.PartitionState<K,V>
- Direct Known Subclasses:
RemovedPartitionState
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longSymbolic value for a parameter which is initialised as having an offset absent (instead of using Optional or null) -
Constructor Summary
ConstructorsConstructorDescriptionPartitionState(org.apache.kafka.common.TopicPartition tp, OffsetMapCodecManager.HighestOffsetAndIncompletes offsetData) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddWorkContainer(WorkContainer<K, V> wc) Optional<org.apache.kafka.clients.consumer.OffsetAndMetadata>intlongThe highest seen offset for a partition.longDefined for our purpose (as only used in definition of what offset to poll for next), as the offset one below the lowest incomplete offset.longHighest offset which has completed successfully ("succeeded").org.apache.kafka.common.TopicPartitiongetTp()booleanbooleanConvenience method for readabilitybooleanisRecordPreviouslyCompleted(org.apache.kafka.clients.consumer.ConsumerRecord<K, V> rec) booleanHas this partition been removed? No.voidonFailure(WorkContainer<K, V> work) voidonOffsetCommitSuccess(org.apache.kafka.clients.consumer.OffsetAndMetadata committed) voidvoidonSuccess(WorkContainer<K, V> work) toString()
-
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:
-
-
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()Defined for our purpose (as only used in definition of what offset to poll for next), as the offset one below the lowest incomplete offset. -
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").Note that this may in some conditions, there may be a gap between this and the next offset to poll - that being, there may be some number of transaction marker records above it, and the next offset to poll.
-