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:
  • Field Details

    • KAFKA_OFFSET_ABSENCE

      public static final long KAFKA_OFFSET_ABSENCE
      Symbolic value for a parameter which is initialised as having an offset absent (instead of using Optional or null)
      See Also:
  • Constructor Details

  • Method Details

    • onOffsetCommitSuccess

      public void onOffsetCommitSuccess(org.apache.kafka.clients.consumer.OffsetAndMetadata committed)
    • isRecordPreviouslyCompleted

      public boolean isRecordPreviouslyCompleted(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> rec)
    • hasWorkInCommitQueue

      public boolean hasWorkInCommitQueue()
    • getCommitQueueSize

      public int getCommitQueueSize()
    • onSuccess

      public void onSuccess(WorkContainer<K,V> work)
    • onFailure

      public void onFailure(WorkContainer<K,V> work)
    • addWorkContainer

      public void addWorkContainer(WorkContainer<K,V> wc)
    • isRemoved

      public boolean isRemoved()
      Has this partition been removed? No.
      Returns:
      by definition false in this implementation
    • getCommitDataIfDirty

      public Optional<org.apache.kafka.clients.consumer.OffsetAndMetadata> getCommitDataIfDirty()
    • getAllIncompleteOffsets

      public Set<Long> getAllIncompleteOffsets()
      Returns:
      all incomplete offsets of buffered work in this shard, even if higher than the highest succeeded
    • getIncompleteOffsetsBelowHighestSucceeded

      public Set<Long> 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

      public void onPartitionsRemoved(ShardManager<K,V> sm)
    • isBlocked

      public boolean isBlocked()
      Convenience method for readability
      Returns:
      true if isAllowedMoreRecords() is false
      See Also:
      • isAllowedMoreRecords()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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.