Not able to connect to Atlas Cluster while doing CDC using dbezium in Apache Flink

Hi Team, I am trying to do CDC on MongoDB using the Dbezium Flink Connector
Below is the code where I am creating source to read cdc events across database.

SourceFunction<String> mongoSource =
                .deserializer(new JsonDebeziumDeserializationSchema())

But I facing issues while connecting to mongodb where as I am able to connect with mongoDb from local machine, compaas as well spring boot applications.
Not able to understand what is going wrong here? Is it because DNS resolution issue or there is something we need to at Atlas Side.
Below is the error

Caused by: com.mongodb.MongoConfigurationException: A TXT record is only permitted to contain the keys [authsource, replicaset], 
but the TXT record for '{hostUrl}' contains the keys [loadbalanced, authsource]
com.mongodb.MongoSocketOpenException: Exception opening socket
	at com.mongodb.internal.connection.DefaultServerMonitor$
	at java.base/
Caused by: connect timed out

Are you connecting to a sharded cluster?

Are you using the Debezium Connector for MongoDB or the MongoDB Connector for Apache Kafka?

Where did you obtain the Atlas Connection string from? Are you using the connection string provided within the Atlas UI?

Hi @Atharv_Joshi,

I use flink cdc 3.1.0 to run the following code, and it works well.

// mongodb+srv://

SourceFunction<String> sourceFunction =
                .deserializer(new JsonDebeziumDeserializationSchema())

StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();


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’.