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 method
heartbeat(Map, Map, BlockingConsumer)
from a main loop of a connector.- Author:
- Jiri Pechanec
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Returns the offset to be used when emitting a heartbeat event. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Heartbeat
create
(Duration heartbeatInterval, String topicName, String key, SchemaNameAdjuster schemaNameAdjuster) Provide an instance of Heartbeat objectstatic Heartbeat
create
(Duration heartbeatInterval, String heartbeatQuery, String topicName, String key, JdbcConnection jdbcConnection, HeartbeatErrorHandler errorHandler, SchemaNameAdjuster schemaNameAdjuster) 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
Whether heartbeats are enabled or not.
-
Field Details
-
HEARTBEAT_INTERVAL_PROPERTY_NAME
- See Also:
-
HEARTBEAT_INTERVAL
-
HEARTBEAT_TOPICS_PREFIX
-
DEFAULT_NOOP_HEARTBEAT
No-op Heartbeat implementation
-
-
Method Details
-
heartbeat
void heartbeat(Map<String, ?> partition, Map<String, throws InterruptedException?> offset, BlockingConsumer<org.apache.kafka.connect.source.SourceRecord> consumer) 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 InterruptedExceptionGenerates 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, throws InterruptedException?> offset, BlockingConsumer<org.apache.kafka.connect.source.SourceRecord> consumer) 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, SchemaNameAdjuster schemaNameAdjuster) 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, SchemaNameAdjuster schemaNameAdjuster)
-