Package io.debezium.heartbeat
Interface Heartbeat
-
- All Known Implementing Classes:
DatabaseHeartbeatImpl
,HeartbeatImpl
public interface Heartbeat
A class that is able to generate periodic heartbeat messages based on a pre-configured interval. The clients are supposed to call methodheartbeat(Map, Map, BlockingConsumer)
from a main loop of a connector.- Author:
- Jiri Pechanec
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Heartbeat.OffsetProducer
Returns the offset to be used when emitting a heartbeat event.
-
Field Summary
Fields Modifier and Type Field Description static Heartbeat
DEFAULT_NOOP_HEARTBEAT
No-op Heartbeat implementationstatic Field
HEARTBEAT_INTERVAL
static String
HEARTBEAT_INTERVAL_PROPERTY_NAME
static Field
HEARTBEAT_TOPICS_PREFIX
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Heartbeat
create(Duration heartbeatInterval, String topicName, String key)
Provide an instance of Heartbeat objectstatic Heartbeat
create(Duration heartbeatInterval, String heartbeatQuery, String topicName, String key, JdbcConnection jdbcConnection, HeartbeatErrorHandler errorHandler)
void
forcedBeat(Map<String,?> partition, Map<String,?> offset, BlockingConsumer<org.apache.kafka.connect.source.SourceRecord> consumer)
Generates a heartbeat record unconditionalyvoid
heartbeat(Map<String,?> partition, Heartbeat.OffsetProducer offsetProducer, BlockingConsumer<org.apache.kafka.connect.source.SourceRecord> consumer)
Generates a heartbeat record if defined time has elapsedvoid
heartbeat(Map<String,?> partition, Map<String,?> offset, BlockingConsumer<org.apache.kafka.connect.source.SourceRecord> consumer)
Generates a heartbeat record if defined time has elapsedboolean
isEnabled()
Whether heartbeats are enabled or not.
-
-
-
Field Detail
-
HEARTBEAT_INTERVAL_PROPERTY_NAME
static final String HEARTBEAT_INTERVAL_PROPERTY_NAME
- See Also:
- Constant Field Values
-
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 recordoffset
- offset for the heartbeat recordconsumer
- - 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 recordoffsetProducer
- lazily calculated offset for the heartbeat recordconsumer
- - 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 recordoffset
- offset for the heartbeat recordconsumer
- - 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.DurationtopicName
- topic to which the heartbeat messages will be sentkey
- kafka partition key to use for the heartbeat message
-
create
static Heartbeat create(Duration heartbeatInterval, String heartbeatQuery, String topicName, String key, JdbcConnection jdbcConnection, HeartbeatErrorHandler errorHandler)
-
-