Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-5563

Clarify handling of connector name in config

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.11.0.0
    • Fix Version/s: 1.1.0
    • Component/s: KafkaConnect
    • Labels:
      None

      Description

      The connector name is currently being stored in two places, once at the root level of the connector and once in the config:

      {
      	"name": "test",
      	"config": {
      		"connector.class": "org.apache.kafka.connect.tools.MockSinkConnector",
      		"tasks.max": "3",
      		"topics": "test-topic",
      		"name": "test"
      	},
      	"tasks": [
      		{
      			"connector": "test",
      			"task": 0
      		}
      	]
      }
      

      If no name is provided in the "config" element, then the name from the root level is copied there when the connector is being created. If however a name is provided in the config then it is not touched, which means it is possible to create a connector with a different name at the root level and in the config like this:

      {
      	"name": "test1",
      	"config": {
      		"connector.class": "org.apache.kafka.connect.tools.MockSinkConnector",
      		"tasks.max": "3",
      		"topics": "test-topic",
      		"name": "differentname"
      	},
      	"tasks": [
      		{
      			"connector": "test1",
      			"task": 0
      		}
      	]
      }
      

      I am not aware of any issues that this currently causes, but it is at least confusing and probably not intended behavior and definitely bears potential for bugs, if different functions take the name from different places.

      Would it make sense to add a check to reject requests that provide different names in the request and the config section?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sliebau Sönke Liebau
                Reporter:
                sliebau Sönke Liebau
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: