Connecting to MongoDB and fetch data for initial snapshot and CDC

61 views
Skip to first unread message

Ramendu

unread,
Oct 19, 2021, 2:22:43 AM10/19/21
to debezium
Hi All, 

Greetings of the day, hope you are keeping well :)

Use Case :

I am making a product where I need to consume data from MongoDB as source connector which is dumped to an intermediate platform which does the rest task of writing to the target. I am not using the typical Kafka setup and architecture but using the embedded Debezium to achieve my task. I have two queries related to this use case. 

Query 1

I am trying to follow the java sample code from the mysql section but when I run my I am getting below error. Can someone please help me with the possible reason and resolution to this?

java.lang.ClassCastException: class java.lang.String cannot be cast to class org.apache.kafka.connect.data.Struct (java.lang.String is in module java.base of loader 'bootstrap'; org.apache.kafka.connect.data.Struct is in unnamed module of loader 'app')
at com.ramendu.mongodbz.listener.CDCListener.handleEvent(CDCListener.java:95) ~[classes/:na]
at io.debezium.embedded.EmbeddedEngine$1.handleBatch(EmbeddedEngine.java:473) ~[debezium-embedded-1.7.0.Final.jar:1.7.0.Final]
at io.debezium.embedded.EmbeddedEngine.run(EmbeddedEngine.java:821) ~[debezium-embedded-1.7.0.Final.jar:1.7.0.Final]

I am also attaching the code file which I am using.

Query 2

Could any one please point me to some sample project for MongoDB Debezium connector, it will help me immensely in getting kickstarted.

Thanks in advance :) 

Best Regards,
Ramendu
DebeziumConnectorConfig.java
CDCListener.java
Operation.java
MongodbzApplication.java
Reply all
Reply to author
Forward
0 new messages