最近在研究debezium相关功能,因为官网上推荐使用kafka的方式,但是kafka比较繁琐,使用起来配置比较麻烦,所以使用嵌入式方式摆脱kafka的束缚,以下是嵌入式相关配置:
@Bean
io.debezium.config.Configuration debeziumConfig() {
return io.debezium.config.Configuration.create()
//连接器的唯一名称
.with("name", "mongoDB-connector")
// 连接器的Java类名称
.with("connector.class", "io.debezium.connector.mongodb.MongoDbConnector")
//数据库的hostname
.with("mongodb.hosts", "myrs/192.168.137.100:27017")
.with("mongodb.name", "myrs")
.with("collection.include.list", "articledb.SYS_USER")
.with("include.schema.changes", "false")
.with("tasks.max","1")
.with("offset.storage","org.apache.kafka.connect.storage.FileOffsetBackingStore")
.with("offset.storage.file.filename", "D://kaifa/spring-boot-debezium/tmp/offsets_mongodb.dat")
.with("database.history", "io.debezium.relational.history.FileDatabaseHistory")
历史变更记录存储位置
.with("database.history.file.filename", "D://kaifa/spring-boot-debezium/tmp/dbhistory_mongodb.dat")
.with("snapshot.delay.ms",6000)
.build();
}
相关嵌入式debezium demo地址参考:https://gitee.com/felord/spring-boot-debezium.git



