Skip to content

Instantly share code, notes, and snippets.

@tzolov
Last active April 8, 2022 12:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tzolov/c3bfa56237f0d4ceb53a93b6c80436e3 to your computer and use it in GitHub Desktop.
Save tzolov/c3bfa56237f0d4ceb53a93b6c80436e3 to your computer and use it in GitHub Desktop.
Use cdc-spring-boot-starter to bootstrap embedded Debezium engine in any Spring Boot application
# For further information follow the instructions at:
# https://github.com/tzolov/cdc-debezium/tree/master/spring-cloud-starter-stream-common-cdc/cdc-spring-boot-starter
cdc.config.offset.flush.interval.ms=60000
cdc.config.name=my-sql-connector
cdc.config.server.id=85744
cdc.config.database.history=io.debezium.relational.history.MemoryDatabaseHistory
cdc.config.database.server.name=my-app-connector
cdc.config.connector.class=io.debezium.connector.mysql.MySqlConnector
cdc.config.database.user=debezium
cdc.config.database.password=dbz
cdc.config.database.hostname=localhost
cdc.config.database.port=3306
cdc.filtering.enabled=false
cdc.includeSchema=false
<dependency>
<groupId>org.springframework.cloud.stream.app</groupId>
<artifactId>cdc-spring-boot-starter</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>
<!-- For further information follow the instructions at:
https://github.com/tzolov/cdc-debezium/tree/master/spring-cloud-starter-stream-common-cdc/cdc-spring-boot-starter -->
// For further information follow the instructions at:
// https://github.com/tzolov/cdc-debezium/tree/master/spring-cloud-starter-stream-common-cdc/cdc-spring-boot-starter
@SpringBootApplication
@AutoConfigureBefore(CdcAutoConfiguration.class)
public class CdcDemoApplication {
public static void main(String[] args) {
SpringApplication.run(CdcDemoApplication.class, args);
}
@Bean
public Consumer<SourceRecord> mySourceRecordConsumer() {
return sourceRecord -> {
System.out.println(" My handler: " + sourceRecord.toString());
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment