I’m using the mongodb source and sink connectors. It’s very easy to produce the change streams to a kafka topic per each collection on a single mongodb source connector (which has no collection field). But, I couldn’t find out how to consume the change streams to a mongodb collection per each kafka topic. Is it not possible? or am I missing something?
You need to specify the MongoDB CDC Event handler at the sink. ( com.mongodb.kafka.connect.sink.cdc.mongodb.ChangeStreamHandler)
See the " Selective Replication in MongoDB" section in this blog post https://www.mongodb.com/blog/post/mongodb-connector-apache-kafka-1-4-available-now
I’m in the process or writing tutorials for the kafka connector, there is one that is already done that covers this: