Class MySqlSource<T>
- java.lang.Object
-
- org.apache.flink.cdc.connectors.mysql.source.MySqlSource<T>
-
- Type Parameters:
T- the output type of the source.
- All Implemented Interfaces:
Serializable,org.apache.flink.api.connector.source.Source<T,MySqlSplit,PendingSplitsState>,org.apache.flink.api.connector.source.SourceReaderFactory<T,MySqlSplit>,org.apache.flink.api.java.typeutils.ResultTypeQueryable<T>
@Internal public class MySqlSource<T> extends Object implements org.apache.flink.api.connector.source.Source<T,MySqlSplit,PendingSplitsState>, org.apache.flink.api.java.typeutils.ResultTypeQueryable<T>
The MySQL CDC Source based on FLIP-27 and Watermark Signal Algorithm which supports parallel reading snapshot of table and then continue to capture data change from binlog.1. The source supports parallel capturing table change. 2. The source supports checkpoint in split level when read snapshot data. 3. The source doesn't need apply any lock of MySQL.MySqlSource .<String>builder() .hostname("localhost") .port(3306) .databaseList("mydb") .tableList("mydb.users") .username(username) .password(password) .serverId(5400) .deserializer(new JsonDebeziumDeserializationSchema()) .build();See
MySqlSourceBuilderfor more details.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> MySqlSourceBuilder<T>builder()Get a MySqlParallelSourceBuilder to build aMySqlSource.org.apache.flink.api.connector.source.SplitEnumerator<MySqlSplit,PendingSplitsState>createEnumerator(org.apache.flink.api.connector.source.SplitEnumeratorContext<MySqlSplit> enumContext)org.apache.flink.api.connector.source.SourceReader<T,MySqlSplit>createReader(org.apache.flink.api.connector.source.SourceReaderContext readerContext)org.apache.flink.api.connector.source.BoundednessgetBoundedness()MySqlSourceConfigFactorygetConfigFactory()org.apache.flink.core.io.SimpleVersionedSerializer<PendingSplitsState>getEnumeratorCheckpointSerializer()org.apache.flink.api.common.typeinfo.TypeInformation<T>getProducedType()org.apache.flink.core.io.SimpleVersionedSerializer<MySqlSplit>getSplitSerializer()org.apache.flink.api.connector.source.SplitEnumerator<MySqlSplit,PendingSplitsState>restoreEnumerator(org.apache.flink.api.connector.source.SplitEnumeratorContext<MySqlSplit> enumContext, PendingSplitsState checkpoint)voidsetSnapshotHooks(SnapshotPhaseHooks snapshotHooks)
-
-
-
Method Detail
-
builder
@PublicEvolving public static <T> MySqlSourceBuilder<T> builder()
Get a MySqlParallelSourceBuilder to build aMySqlSource.- Returns:
- a MySql parallel source builder.
-
getConfigFactory
public MySqlSourceConfigFactory getConfigFactory()
-
getBoundedness
public org.apache.flink.api.connector.source.Boundedness getBoundedness()
- Specified by:
getBoundednessin interfaceorg.apache.flink.api.connector.source.Source<T,MySqlSplit,PendingSplitsState>
-
createReader
public org.apache.flink.api.connector.source.SourceReader<T,MySqlSplit> createReader(org.apache.flink.api.connector.source.SourceReaderContext readerContext) throws Exception
- Specified by:
createReaderin interfaceorg.apache.flink.api.connector.source.SourceReaderFactory<T,MySqlSplit>- Throws:
Exception
-
createEnumerator
public org.apache.flink.api.connector.source.SplitEnumerator<MySqlSplit,PendingSplitsState> createEnumerator(org.apache.flink.api.connector.source.SplitEnumeratorContext<MySqlSplit> enumContext)
- Specified by:
createEnumeratorin interfaceorg.apache.flink.api.connector.source.Source<T,MySqlSplit,PendingSplitsState>
-
restoreEnumerator
public org.apache.flink.api.connector.source.SplitEnumerator<MySqlSplit,PendingSplitsState> restoreEnumerator(org.apache.flink.api.connector.source.SplitEnumeratorContext<MySqlSplit> enumContext, PendingSplitsState checkpoint)
- Specified by:
restoreEnumeratorin interfaceorg.apache.flink.api.connector.source.Source<T,MySqlSplit,PendingSplitsState>
-
getSplitSerializer
public org.apache.flink.core.io.SimpleVersionedSerializer<MySqlSplit> getSplitSerializer()
- Specified by:
getSplitSerializerin interfaceorg.apache.flink.api.connector.source.Source<T,MySqlSplit,PendingSplitsState>
-
getEnumeratorCheckpointSerializer
public org.apache.flink.core.io.SimpleVersionedSerializer<PendingSplitsState> getEnumeratorCheckpointSerializer()
- Specified by:
getEnumeratorCheckpointSerializerin interfaceorg.apache.flink.api.connector.source.Source<T,MySqlSplit,PendingSplitsState>
-
getProducedType
public org.apache.flink.api.common.typeinfo.TypeInformation<T> getProducedType()
- Specified by:
getProducedTypein interfaceorg.apache.flink.api.java.typeutils.ResultTypeQueryable<T>
-
setSnapshotHooks
@VisibleForTesting public void setSnapshotHooks(SnapshotPhaseHooks snapshotHooks)
-
-