Running docker containers for Kafka-MQTT-MongoDB; LEADER_NOT_AVAILABLE for kafka topic

I am running Docker containers for kafka, zookeeper, kafka-connect, mongoDB & mosquitto within a network.
When i register connector for mqtt source and send a message to bootstrap server: kafka:29092, I get the following warning when I listen to the topic.

    docker exec kafka kafka-console-consumer --bootstrap-server kafka:29092 --topic connect-custom --from-beginning --max-messages 42
[2021-08-25 11:53:04,555] WARN [Consumer clientId=consumer-1, groupId=console-consumer-40150] Error while fetching metadata with correlation id 2 : {connect-custom=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)

Following is the configuration for mqtt source connector.

{
    "name": "mqtt-source",
    "config": {
        "connector.class": "io.confluent.connect.mqtt.MqttSourceConnector",
        "tasks.max": 1,
        "mqtt.server.uri": "tcp://mosquitto:1883",
        "mqtt.topics": "spa-mqtt",
        "kafka.topic": "connect-custom",
        "value.converter": "org.apache.kafka.connect.converters.ByteArrayConverter",
        "confluent.topic.bootstrap.servers": "kafka:29092",
        "confluent.topic.replication.factor": 1
    }
}

Source: Docker Questions

LEAVE A COMMENT