Class KafkaCheckpointCommit

  • All Implemented Interfaces:
    KafkaCommitHandler

    @Experimental("Experimental API")
    public class KafkaCheckpointCommit
    extends ContextHolder
    implements KafkaCommitHandler
    Commit handler for checkpointing processing state persisted in a state store

    Instead of committing topic-partition offsets back to Kafka, checkpointing commit handlers persist and restore offsets on an external store. It associates a ProcessingState with a topic-partition offset, and lets the processing resume from the checkpointed state.

    This abstract implementation holds a local map of ProcessingState per topic-partition, and ensures it is accessed on the captured Vert.x context.

    • Method Detail

      • received

        public <K,​V> io.smallrye.mutiny.Uni<IncomingKafkaRecord<K,​V>> received​(IncomingKafkaRecord<K,​V> record)
        Called on Vert.x event loop
        Specified by:
        received in interface KafkaCommitHandler
        Type Parameters:
        K - type of record key
        V - type of record value
        Parameters:
        record - incoming Kafka record
        Returns:
        the Uni yielding the received record
      • handle

        public <K,​V> io.smallrye.mutiny.Uni<Void> handle​(IncomingKafkaRecord<K,​V> record)
        Called on Vert.x event loop
        Specified by:
        handle in interface KafkaCommitHandler
        Type Parameters:
        K - type of record key
        V - type of record value
        Parameters:
        record - incoming Kafka record
        Returns:
        a completion stage completed when the message is acknowledged.
      • terminate

        public void terminate​(boolean graceful)
        Description copied from interface: KafkaCommitHandler
        Called on channel shutdown
        Specified by:
        terminate in interface KafkaCommitHandler
        Parameters:
        graceful - true if it is a graceful shutdown
      • partitionsAssigned

        public void partitionsAssigned​(Collection<org.apache.kafka.common.TopicPartition> partitions)
        Description copied from interface: KafkaCommitHandler
        Called on partitions assigned on Kafka rebalance listener
        Specified by:
        partitionsAssigned in interface KafkaCommitHandler
        Parameters:
        partitions - assigned partitions
      • partitionsRevoked

        public void partitionsRevoked​(Collection<org.apache.kafka.common.TopicPartition> partitions)
        Description copied from interface: KafkaCommitHandler
        Called on partitions revokd on Kafka rebalance listener
        Specified by:
        partitionsRevoked in interface KafkaCommitHandler
        Parameters:
        partitions - revoked partitions