io.debezium.connector.mysql.MySqlConnector Maven / Gradle / Ivy
/*
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.connector.mysql;
import java.util.Map;
import org.apache.kafka.common.config.ConfigDef;
import org.apache.kafka.common.config.ConfigValue;
import org.apache.kafka.connect.connector.Task;
import io.debezium.config.Configuration;
import io.debezium.connector.binlog.BinlogConnector;
import io.debezium.connector.mysql.jdbc.MySqlConnection;
import io.debezium.connector.mysql.jdbc.MySqlConnectionConfiguration;
import io.debezium.connector.mysql.jdbc.MySqlFieldReaderResolver;
/**
* A Kafka Connect source connector that creates tasks that read the MySQL binary log and generate the corresponding
* data change events.
* Configuration
*
* This connector is configured with the set of properties described in {@link MySqlConnectorConfig}.
*
*
* @author Randall Hauch
*/
public class MySqlConnector extends BinlogConnector {
public MySqlConnector() {
}
@Override
public String version() {
return Module.version();
}
@Override
public Class extends Task> taskClass() {
return MySqlConnectorTask.class;
}
@Override
public ConfigDef config() {
return MySqlConnectorConfig.configDef();
}
@Override
protected Map validateAllFields(Configuration config) {
return config.validate(MySqlConnectorConfig.ALL_FIELDS);
}
@Override
protected MySqlConnection createConnection(Configuration config, MySqlConnectorConfig connectorConfig) {
return new MySqlConnection(
new MySqlConnectionConfiguration(config),
MySqlFieldReaderResolver.resolve(connectorConfig));
}
@Override
protected MySqlConnectorConfig createConnectorConfig(Configuration config) {
return new MySqlConnectorConfig(config);
}
}