Package io.debezium.connector.mysql
Class MySqlConnectorTask
- java.lang.Object
-
- org.apache.kafka.connect.source.SourceTask
-
- io.debezium.connector.common.BaseSourceTask<MySqlOffsetContext>
-
- io.debezium.connector.mysql.MySqlConnectorTask
-
- All Implemented Interfaces:
org.apache.kafka.connect.connector.Task
public class MySqlConnectorTask extends BaseSourceTask<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 MySqlConnection
connection
private static String
CONTEXT_NAME
private ErrorHandler
errorHandler
private static org.slf4j.Logger
LOGGER
private ChangeEventQueue<DataChangeEvent>
queue
private MySqlDatabaseSchema
schema
private MySqlTaskContext
taskContext
-
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 void
doStop()
protected Iterable<Field>
getAllConfigurationFields()
private MySqlValueConverters
getValueConverters(MySqlConnectorConfig configuration)
protected boolean
isBinlogAvailable(MySqlConnectorConfig config, MySqlOffsetContext offset)
Determine whether the binlog position as set on theSourceInfo
is available in the server.ChangeEventSourceCoordinator<MySqlOffsetContext>
start(Configuration config)
private boolean
validateAndLoadDatabaseHistory(MySqlConnectorConfig config, MySqlOffsetContext offset, MySqlDatabaseSchema schema)
private void
validateBinlogConfiguration(MySqlConnectorConfig config)
private boolean
validateSnapshotFeasibility(MySqlConnectorConfig config, MySqlOffsetContext offset)
String
version()
-
Methods inherited from class io.debezium.connector.common.BaseSourceTask
commit, commitRecord, getPreviousOffset, 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<MySqlOffsetContext> start(Configuration config)
- Specified by:
start
in classBaseSourceTask<MySqlOffsetContext>
-
getValueConverters
private MySqlValueConverters getValueConverters(MySqlConnectorConfig configuration)
-
doPoll
public List<org.apache.kafka.connect.source.SourceRecord> doPoll() throws InterruptedException
- Specified by:
doPoll
in classBaseSourceTask<MySqlOffsetContext>
- Throws:
InterruptedException
-
doStop
protected void doStop()
- Specified by:
doStop
in classBaseSourceTask<MySqlOffsetContext>
-
getAllConfigurationFields
protected Iterable<Field> getAllConfigurationFields()
- Specified by:
getAllConfigurationFields
in classBaseSourceTask<MySqlOffsetContext>
-
validateBinlogConfiguration
private void validateBinlogConfiguration(MySqlConnectorConfig config)
-
isBinlogAvailable
protected boolean isBinlogAvailable(MySqlConnectorConfig config, MySqlOffsetContext offset)
Determine whether the binlog position as set on theSourceInfo
is available in the server.- Returns:
true
if the server has the binlog coordinates, orfalse
otherwise
-
validateAndLoadDatabaseHistory
private boolean validateAndLoadDatabaseHistory(MySqlConnectorConfig config, MySqlOffsetContext offset, MySqlDatabaseSchema schema)
-
validateSnapshotFeasibility
private boolean validateSnapshotFeasibility(MySqlConnectorConfig config, MySqlOffsetContext offset)
-
-