Mongodb-kafka connector failing while connecting MSK to Mongodb

240 Views Asked by At

Im trying to connect MongoDB with AWS Managed kafka using the source connector (downloaded from Confluent Hub), but while creating AWS connector im getting the error message: Code: InvalidInput.InvalidConnectorConfiguration Message: The connector configuration is invalid.Message: Request failed.

configurations file in connector:

name=mongo-source 
connector.class=com.mongodb.kafka.connect.MongoSourceConnector 
tasks.max=1 
connection.uri=<Connection.uri> 
database=<database.name> 
collection=<coll.name> 
topic.prefix=Topic1

mongo-kafka connector: https://www.confluent.io/hub/mongodb/kafka-connect-mongodb

What are the correct configurations for mongo-kafka confluent connecter and is there a way to see the logs for the msk connector to identity which configuration is issue here

1

There are 1 best solutions below

0
Sandun Sameera On

After some research I found below configuration works,

connector.class=com.mongodb.kafka.connect.MongoSinkConnector
database=<mongodb database>
tasks.max=1
topics=<your kafka topic>
connection.uri= <mongodb url>
value.converter.schemas.enable=false
collection=<mongodb collection>
value.converter=org.apache.kafka.connect.json.JsonConverter
key.converter=org.apache.kafka.connect.storage.StringConverter

Please make sure to change key and value converters appropriately. you can get more support here

note: you can use value converter as per your requirement. (string,byte array, json)