Package io.debezium.connector.mysql
Class MySqlConnectorTask
- java.lang.Object
-
- org.apache.kafka.connect.source.SourceTask
-
- io.debezium.connector.common.BaseSourceTask<MySqlPartition,MySqlOffsetContext>
-
- io.debezium.connector.mysql.MySqlConnectorTask
-
- All Implemented Interfaces:
org.apache.kafka.connect.connector.Task
public class MySqlConnectorTask extends BaseSourceTask<MySqlPartition,MySqlOffsetContext>
The main task executing streaming from MySQL. Responsible for lifecycle management of the streaming code.- Author:
- Jiri Pechanec
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.debezium.connector.common.BaseSourceTask
BaseSourceTask.State
-
-
Field Summary
Fields Modifier and Type Field Description private MySqlConnectionconnectionprivate static StringCONTEXT_NAMEprivate ErrorHandlererrorHandlerprivate static org.slf4j.LoggerLOGGERprivate ChangeEventQueue<DataChangeEvent>queueprivate MySqlDatabaseSchemaschemaprivate MySqlTaskContexttaskContext
-
Constructor Summary
Constructors Constructor Description MySqlConnectorTask()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<org.apache.kafka.connect.source.SourceRecord>doPoll()protected voiddoStop()protected Iterable<Field>getAllConfigurationFields()private MySqlValueConvertersgetValueConverters(MySqlConnectorConfig configuration)protected booleanisBinlogAvailable(MySqlConnectorConfig config, MySqlOffsetContext offset)Determine whether the binlog position as set on theMySqlOffsetContextis available in the server.ChangeEventSourceCoordinator<MySqlPartition,MySqlOffsetContext>start(Configuration config)private booleanvalidateAndLoadDatabaseHistory(MySqlConnectorConfig config, MySqlPartition partition, MySqlOffsetContext offset, MySqlDatabaseSchema schema)private voidvalidateBinlogConfiguration(MySqlConnectorConfig config)private booleanvalidateSnapshotFeasibility(MySqlConnectorConfig config, MySqlOffsetContext offset)Stringversion()-
Methods inherited from class io.debezium.connector.common.BaseSourceTask
commit, commitRecord, getPreviousOffsets, poll, start, stop
-
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
CONTEXT_NAME
private static final String CONTEXT_NAME
- See Also:
- Constant Field Values
-
taskContext
private volatile MySqlTaskContext taskContext
-
queue
private volatile ChangeEventQueue<DataChangeEvent> queue
-
connection
private volatile MySqlConnection connection
-
errorHandler
private volatile ErrorHandler errorHandler
-
schema
private volatile MySqlDatabaseSchema schema
-
-
Method Detail
-
version
public String version()
-
start
public ChangeEventSourceCoordinator<MySqlPartition,MySqlOffsetContext> start(Configuration config)
- Specified by:
startin classBaseSourceTask<MySqlPartition,MySqlOffsetContext>
-
getValueConverters
private MySqlValueConverters getValueConverters(MySqlConnectorConfig configuration)
-
doPoll
public List<org.apache.kafka.connect.source.SourceRecord> doPoll() throws InterruptedException
- Specified by:
doPollin classBaseSourceTask<MySqlPartition,MySqlOffsetContext>- Throws:
InterruptedException
-
doStop
protected void doStop()
- Specified by:
doStopin classBaseSourceTask<MySqlPartition,MySqlOffsetContext>
-
getAllConfigurationFields
protected Iterable<Field> getAllConfigurationFields()
- Specified by:
getAllConfigurationFieldsin classBaseSourceTask<MySqlPartition,MySqlOffsetContext>
-
validateBinlogConfiguration
private void validateBinlogConfiguration(MySqlConnectorConfig config)
-
isBinlogAvailable
protected boolean isBinlogAvailable(MySqlConnectorConfig config, MySqlOffsetContext offset)
Determine whether the binlog position as set on theMySqlOffsetContextis available in the server.- Returns:
trueif the server has the binlog coordinates, orfalseotherwise
-
validateAndLoadDatabaseHistory
private boolean validateAndLoadDatabaseHistory(MySqlConnectorConfig config, MySqlPartition partition, MySqlOffsetContext offset, MySqlDatabaseSchema schema)
-
validateSnapshotFeasibility
private boolean validateSnapshotFeasibility(MySqlConnectorConfig config, MySqlOffsetContext offset)
-
-