Package io.debezium.heartbeat
Class HeartbeatImpl
java.lang.Object
io.debezium.heartbeat.HeartbeatImpl
- All Implemented Interfaces:
Heartbeat,Heartbeat.ScheduledHeartbeat,AutoCloseable
Default implementation of Heartbeat
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.debezium.heartbeat.Heartbeat
Heartbeat.OffsetProducer, Heartbeat.ScheduledHeartbeat -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final intDefault length of interval in which connector generates periodically heartbeat messages.(package private) static final StringDefault prefix for names of heartbeat topicsprivate final Durationprivate io.debezium.util.Threads.Timerprivate final Stringprivate final org.apache.kafka.connect.data.Schemaprivate static final org.slf4j.Loggerprivate final ChangeEventQueue<DataChangeEvent> static final Stringprivate final org.apache.kafka.connect.data.Structprivate final Stringprivate final org.apache.kafka.connect.data.SchemaFields inherited from interface io.debezium.heartbeat.Heartbeat
DEFAULT_NOOP_HEARTBEAT, HEARTBEAT_INTERVAL, HEARTBEAT_INTERVAL_PROPERTY_NAME, HEARTBEAT_TOPICS_PREFIXFields inherited from interface io.debezium.heartbeat.Heartbeat.ScheduledHeartbeat
NOOP_HEARTBEAT -
Constructor Summary
ConstructorsConstructorDescriptionHeartbeatImpl(Duration heartbeatInterval, String topicName, String key, SchemaNameAdjuster schemaNameAdjuster) HeartbeatImpl(Duration heartbeatInterval, String topicName, String key, SchemaNameAdjuster schemaNameAdjuster, ChangeEventQueue<DataChangeEvent> queue) -
Method Summary
Modifier and TypeMethodDescriptionvoidemit(Map<String, ?> partition, OffsetContext offset) Generates a heartbeat record unconditionallyvoidemitWithDelay(Map<String, ?> partition, OffsetContext offset) Generates a heartbeat record if defined time has elapsedbooleanexpired()voidforcedBeat(Map<String, ?> partition, Map<String, ?> offset, BlockingConsumer<org.apache.kafka.connect.source.SourceRecord> consumer) Generates a heartbeat record unconditionally Replaced byHeartbeat.emit(Map, OffsetContext)voidheartbeat(Map<String, ?> partition, Heartbeat.OffsetProducer offsetProducer, BlockingConsumer<org.apache.kafka.connect.source.SourceRecord> consumer) Generates a heartbeat record if defined time has elapsed Replaced byHeartbeat.ScheduledHeartbeat.emitWithDelay(Map, OffsetContext)voidheartbeat(Map<String, ?> partition, Map<String, ?> offset, BlockingConsumer<org.apache.kafka.connect.source.SourceRecord> consumer) Generates a heartbeat record if defined time has elapsed Replaced byHeartbeat.ScheduledHeartbeat.emitWithDelay(Map, OffsetContext)private org.apache.kafka.connect.source.SourceRecordheartbeatRecord(Map<String, ?> sourcePartition, Map<String, ?> sourceOffset) Produce an empty record to the heartbeat topic.booleanWhether heartbeats are enabled or not.private org.apache.kafka.connect.data.StructProduce a value struct containing the timestampvoidreset()reset the timer for the heartbeatprivate io.debezium.util.Threads.Timerprivate org.apache.kafka.connect.data.Struct
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
DEFAULT_HEARTBEAT_INTERVAL
static final int DEFAULT_HEARTBEAT_INTERVALDefault length of interval in which connector generates periodically heartbeat messages. A size of 0 disables heartbeat.- See Also:
-
DEFAULT_HEARTBEAT_TOPICS_PREFIX
Default prefix for names of heartbeat topics- See Also:
-
SERVER_NAME_KEY
- See Also:
-
topicName
-
heartbeatInterval
-
key
-
keySchema
private final org.apache.kafka.connect.data.Schema keySchema -
valueSchema
private final org.apache.kafka.connect.data.Schema valueSchema -
serverNameKey
private final org.apache.kafka.connect.data.Struct serverNameKey -
queue
-
heartbeatTimeout
private volatile io.debezium.util.Threads.Timer heartbeatTimeout
-
-
Constructor Details
-
HeartbeatImpl
public HeartbeatImpl(Duration heartbeatInterval, String topicName, String key, SchemaNameAdjuster schemaNameAdjuster) -
HeartbeatImpl
public HeartbeatImpl(Duration heartbeatInterval, String topicName, String key, SchemaNameAdjuster schemaNameAdjuster, ChangeEventQueue<DataChangeEvent> queue)
-
-
Method Details
-
heartbeat
public void heartbeat(Map<String, ?> partition, Map<String, throws InterruptedException?> offset, BlockingConsumer<org.apache.kafka.connect.source.SourceRecord> consumer) Description copied from interface:HeartbeatGenerates a heartbeat record if defined time has elapsed Replaced byHeartbeat.ScheduledHeartbeat.emitWithDelay(Map, OffsetContext)- Specified by:
heartbeatin interfaceHeartbeat- 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
public void heartbeat(Map<String, ?> partition, Heartbeat.OffsetProducer offsetProducer, BlockingConsumer<org.apache.kafka.connect.source.SourceRecord> consumer) throws InterruptedExceptionDescription copied from interface:HeartbeatGenerates a heartbeat record if defined time has elapsed Replaced byHeartbeat.ScheduledHeartbeat.emitWithDelay(Map, OffsetContext)- Specified by:
heartbeatin interfaceHeartbeat- 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
public void forcedBeat(Map<String, ?> partition, Map<String, throws InterruptedException?> offset, BlockingConsumer<org.apache.kafka.connect.source.SourceRecord> consumer) Description copied from interface:HeartbeatGenerates a heartbeat record unconditionally Replaced byHeartbeat.emit(Map, OffsetContext)- Specified by:
forcedBeatin interfaceHeartbeat- 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
-
emitWithDelay
public void emitWithDelay(Map<String, ?> partition, OffsetContext offset) throws InterruptedExceptionDescription copied from interface:Heartbeat.ScheduledHeartbeatGenerates a heartbeat record if defined time has elapsed- Specified by:
emitWithDelayin interfaceHeartbeat.ScheduledHeartbeat- Parameters:
partition- partition for the heartbeat recordoffset- offset for the heartbeat record- Throws:
InterruptedException
-
expired
public boolean expired()- Specified by:
expiredin interfaceHeartbeat.ScheduledHeartbeat- Returns:
- if the timeout for the scheduled heartbeat is expired
-
reset
public void reset()Description copied from interface:Heartbeat.ScheduledHeartbeatreset the timer for the heartbeat- Specified by:
resetin interfaceHeartbeat.ScheduledHeartbeat
-
emit
Description copied from interface:HeartbeatGenerates a heartbeat record unconditionally- Specified by:
emitin interfaceHeartbeat- Parameters:
partition- partition for the heartbeat recordoffset- offset for the heartbeat record- Throws:
InterruptedException
-
isEnabled
public boolean isEnabled()Description copied from interface:HeartbeatWhether heartbeats are enabled or not. -
serverNameKey
private org.apache.kafka.connect.data.Struct serverNameKey() -
messageValue
private org.apache.kafka.connect.data.Struct messageValue()Produce a value struct containing the timestamp -
heartbeatRecord
private org.apache.kafka.connect.source.SourceRecord heartbeatRecord(Map<String, ?> sourcePartition, Map<String, ?> sourceOffset) Produce an empty record to the heartbeat topic. -
resetHeartbeat
private io.debezium.util.Threads.Timer resetHeartbeat()
-