Kafka Connection Misconfiguration: Unable to Connect to Local Kafka Instance

32 Views Asked by At

I am facing an issue with a Kafka connection setup that I'm trying to configure using a POST request with curl. The goal is to create a connection to a local Kafka instance using the provided credentials. However, when I execute the command, the connection status shows as "misconfigured," indicating that something is not set up correctly.

Here's the command I'm using:

curl -X POST -u devops:foobar -H 'Content-Type: application/json' -d '{
    "targetActorSelection": "/system/sharding/connection",
    "headers": {
        "aggregate": false
    },
    "piggybackCommand": {
        "type": "connectivity.commands:createConnection",
        "connection": {
            "id": "kafka",
            "name": "KAFKA",
            "connectionType": "kafka",
            "connectionStatus": "open",
            "uri": "tcp://localhost:9092",
            "sources": [
                {
                    "addresses": [
                        "kafkaTopic"
                    ],
                    "consumerCount": 1,
                    "qos": 0,
                    "authorizationContext": [
                        "nginx:ditto"
                    ],
                    "headerMapping": {},
                    "payloadMapping": [
                        "Ditto"
                    ],
                    "replyTarget": {
                        "address": "kakfaReplyTopic",
                        "headerMapping": {},
                        "expectedResponseTypes": [
                            "response",
                            "error",
                            "nack"
                        ],
                        "enabled": true
                    }
                }
            ],
            "targets": [
                {
                    "address": "kafkaTargetTopic",
                    "topics": [
                        "_/_/things/twin/events",
                        "_/_/things/live/messages"
                    ],
                    "authorizationContext": [
                        "nginx:ditto"
                    ],
                    "headerMapping": {}
                }
            ],
            "clientCount": 1,
            "failoverEnabled": true,
            "validateCertificates": false,
            "processorPoolSize": 1,
            "specificConfig": {
                "saslMechanism": "plain",
                "bootstrapServers": "localhost:9092"
            },
            "mappingDefinitions": {
                "Ditto": {
                    "mappingEngine": "JavaScript",
                    "options": {
                        "incomingScript": "",
                        "outgoingScript": "",
                        "loadBytebufferJS": "false",
                        "loadLongJS": "false"
                    }
                }
            },
            "tags": []
        }
    }
}' http://localhost:8080/devops/piggyback/connectivity?timeout=8s

The issue is that the connection status remains "misconfigured," and I'm unable to establish the connection to the local Kafka instance running on localhost:9092. I have already verified that Kafka is up and running and accessible locally, but it seems there might be a misconfiguration in the request parameters.

Could someone please help me identify the misconfiguration or any potential issues with the provided request? Your assistance would be greatly appreciated. Thank you!

0

There are 0 best solutions below