Last active
April 8, 2022 12:05
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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 --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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