Interface Heartbeat

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
DatabaseHeartbeatImpl, HeartbeatImpl

public interface Heartbeat extends AutoCloseable
A class that is able to generate periodic heartbeat messages based on a pre-configured interval. The clients are supposed to call method heartbeat(Map, Map, BlockingConsumer) from a main loop of a connector.
Author:
Jiri Pechanec
  • Field Details

    • HEARTBEAT_INTERVAL_PROPERTY_NAME

      static final String HEARTBEAT_INTERVAL_PROPERTY_NAME
      See Also:
    • 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 Details

    • 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.
    • close

      default void close()
      Specified by:
      close in interface AutoCloseable