Class BlockingReader
java.lang.Object
io.debezium.connector.mysql.legacy.BlockingReader
- All Implemented Interfaces:
Reader
- Direct Known Subclasses:
TimedBlockingReader
A component that blocks doing nothing until the connector task is stopped
- Author:
- Peter Goransson
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.debezium.connector.mysql.legacy.Reader
Reader.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.slf4j.Loggerprivate final Metronomeprivate final Stringprivate final AtomicReference<MySqlPartition>private final Stringprivate final AtomicReference<Reader.State>private final AtomicReference<Consumer<MySqlPartition>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionname()Get the name of this reader.List<org.apache.kafka.connect.source.SourceRecord>poll()Does nothing until the connector task is shut down, but regularly returns control back to Connect in order for being paused if requested.voidstart(MySqlPartition partition) Start the reader and return immediately.state()Get the current state of this reader.voidstop()Stop the reader from running and transition to theReader.State.STOPPINGstate until all remaining records areconsumed, at which point its state transitions toReader.State.STOPPED.voiduponCompletion(Consumer<MySqlPartition> handler) Set the function that should be called when this reader transitions from theReader.State.STOPPINGtoReader.State.STOPPEDstate, which is after all generated records have been consumed via thepollmethod.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.debezium.connector.mysql.legacy.Reader
destroy, initialize
-
Field Details
-
logger
protected final org.slf4j.Logger logger -
uponCompletion
-
partition
-
state
-
metronome
-
name
-
runningLogMessage
-
-
Constructor Details
-
BlockingReader
-
-
Method Details
-
poll
Does nothing until the connector task is shut down, but regularly returns control back to Connect in order for being paused if requested.- Specified by:
pollin interfaceReader- Returns:
- the list of source records that may or may not be empty; or
nullwhen there will be no more records because the reader has completelyReader.State.STOPPED. - Throws:
InterruptedException- if this thread is interrupted while waiting for more records
-
state
Description copied from interface:ReaderGet the current state of this reader. -
uponCompletion
Description copied from interface:ReaderSet the function that should be called when this reader transitions from theReader.State.STOPPINGtoReader.State.STOPPEDstate, which is after all generated records have been consumed via thepollmethod.This method should only be called while the reader is in the
Reader.State.STOPPEDstate.- Specified by:
uponCompletionin interfaceReader- Parameters:
handler- the function; may not be null
-
start
Description copied from interface:ReaderStart the reader and return immediately. Once started, theSourceRecords generated by the reader can be obtained by periodically callingReader.poll()until that method returnsnull.This method does nothing if it is already running.
-
stop
public void stop()Description copied from interface:ReaderStop the reader from running and transition to theReader.State.STOPPINGstate until all remaining records areconsumed, at which point its state transitions toReader.State.STOPPED. -
name
Description copied from interface:ReaderGet the name of this reader.
-