use of com.ververica.cdc.connectors.base.experimental.MySqlSourceBuilder in project flink-cdc-connectors by ververica.
the class MySqlChangeEventSourceExampleTest method testConsumingAllEvents.
@Test
@Ignore("Test ignored because it won't stop and is used for manual test")
public void testConsumingAllEvents() throws Exception {
inventoryDatabase.createAndInitialize();
JdbcIncrementalSource<String> mySqlChangeEventSource = new MySqlSourceBuilder().hostname(MYSQL_CONTAINER.getHost()).port(MYSQL_CONTAINER.getDatabasePort()).databaseList(inventoryDatabase.getDatabaseName()).tableList(inventoryDatabase.getDatabaseName() + ".products").username(inventoryDatabase.getUsername()).password(inventoryDatabase.getPassword()).serverId("5401-5404").deserializer(new JsonDebeziumDeserializationSchema()).includeSchemaChanges(// output the schema changes as well
true).build();
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
// enable checkpoint
env.enableCheckpointing(3000);
// set the source parallelism to 4
env.fromSource(mySqlChangeEventSource, WatermarkStrategy.noWatermarks(), "MySqlParallelSource").setParallelism(4).print().setParallelism(1);
env.execute("Print MySQL Snapshot + Binlog");
}
Aggregations