Hi @Atharv_Joshi,
I use flink cdc 3.1.0 to run the following code, and it works well.
// mongodb+srv://cluster0.xxxxx.mongodb.net/
SourceFunction<String> sourceFunction =
MongoDBSource.<String>builder()
.hosts("cluster0.xxxx.mongodb.net")
.scheme("mongodb+srv")
.username("root")
.password("root")
.databaseList("test")
.collectionList("test.test_coll")
.deserializer(new JsonDebeziumDeserializationSchema())
.build();
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.addSource(sourceFunction)
.print()
.setParallelism(1);
env.execute("Print MongoDB Snapshot + Change Stream Events");
The appearance of this issue seems to be due to a version conflict in the org.mongodb:mongodb-driver-sync, which does not support loadbalance mode.
Please check if the version of the mongodb-driver-sync in the pom file is greater than 4.3.0.
By the way, if using SRV connection format, the ‘scheme’ option needs to be set to ‘mongodb+srv’.
Best,
Jiabao