Interface Heartbeat

    • Field Detail

      • HEARTBEAT_INTERVAL

        static final Field HEARTBEAT_INTERVAL
      • HEARTBEAT_TOPICS_PREFIX

        static final Field HEARTBEAT_TOPICS_PREFIX
      • DEFAULT_NOOP_HEARTBEAT

        static final Heartbeat DEFAULT_NOOP_HEARTBEAT
        No-op Heartbeat implementation
    • Method Detail

      • heartbeat

        void heartbeat​(Map<String,​?> partition,
                       Map<String,​?> offset,
                       BlockingConsumer<org.apache.kafka.connect.source.SourceRecord> consumer)
                throws InterruptedException
        Generates a heartbeat record if defined time has elapsed
        Parameters:
        partition - partition for the heartbeat record
        offset - offset for the heartbeat record
        consumer - - a code to place record among others to be sent into Connect
        Throws:
        InterruptedException
      • heartbeat

        void heartbeat​(Map<String,​?> partition,
                       Heartbeat.OffsetProducer offsetProducer,
                       BlockingConsumer<org.apache.kafka.connect.source.SourceRecord> consumer)
                throws InterruptedException
        Generates a heartbeat record if defined time has elapsed
        Parameters:
        partition - partition for the heartbeat record
        offsetProducer - lazily calculated offset for the heartbeat record
        consumer - - a code to place record among others to be sent into Connect
        Throws:
        InterruptedException
      • forcedBeat

        void forcedBeat​(Map<String,​?> partition,
                        Map<String,​?> offset,
                        BlockingConsumer<org.apache.kafka.connect.source.SourceRecord> consumer)
                 throws InterruptedException
        Generates a heartbeat record unconditionaly
        Parameters:
        partition - partition for the heartbeat record
        offset - offset for the heartbeat record
        consumer - - a code to place record among others to be sent into Connect
        Throws:
        InterruptedException
      • isEnabled

        boolean isEnabled()
        Whether heartbeats are enabled or not.
      • create

        static Heartbeat create​(Duration heartbeatInterval,
                                String topicName,
                                String key)
        Provide an instance of Heartbeat object
        Parameters:
        heartbeatInterval - heartbeat interval config value as java.time.Duration
        topicName - topic to which the heartbeat messages will be sent
        key - kafka partition key to use for the heartbeat message