mongodbapache-kafkaapache-kafka-connectmongodb-kafka-connector

Error: Configuration is not defined: topic


My Kafka Connect is sitting in a Kubernetes cluster which has the mongo-kafka-connect-1.1.0-all.jar in the connectors folder.

I have port forwarded the Kafka Connect service to my localhost and am trying to upload the properties for a Mongo Sink Connector with this curl command (obviously, with my own connection details in the relevant <> places):

curl -X PUT http://localhost:8083/connectors/sink-mongodb/config -H "Content-Type: application/json" -d '{
      "connector.class":"com.mongodb.kafka.connect.MongoSinkConnector",
      "tasks.max":"1",
      "topics":"<topic name>",
      "connection.uri":"mongodb://<username>:<password>@<uri1>:<port1>,<uri2>:<port2>",
      "database":"<database name>",
      "collection":"<collection name>",
      "key.converter":"org.apache.kafka.connect.storage.StringConverter",
      "key.converter.schemas.enable":false,
      "value.converter":"org.apache.kafka.connect.json.JsonConverter",
      "value.converter.schemas.enable":false
}'

However, I get the following error response:

{"error_code":400,"message":"Connector configuration is invalid and contains the following 1 error(s):\nConfiguration is not defined: topic\nUnable to connect to the server.\nYou can also find the above list of errors at the endpoint `/{connectorType}/config/validate`"}

Is my config wrong, am I missing something?


Solution

  • So in the end, the issue was that the I needed to take the .pem file and convert it to a .crt and add this to the server's list of CAs. Essentially the server didn't accept the SSL cert and was refusing to connect.