0
0
Kafkadevops~10 mins

Connector configuration in Kafka - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Connector configuration
Start: Define Connector Config
Set Connector Name
Specify Connector Class
Configure Connection Details
Set Topic and Data Format
Apply Additional Settings
Deploy Connector
Connector Runs and Transfers Data
End
This flow shows how to create and deploy a Kafka connector by defining its configuration step-by-step.
Execution Sample
Kafka
{
  "name": "my-source-connector",
  "connector.class": "FileStreamSource",
  "tasks.max": "1",
  "file": "/tmp/input.txt",
  "topic": "my-topic"
}
This JSON configures a source connector that reads from a file and writes to a Kafka topic.
Process Table
StepConfig KeyValueActionResult
1namemy-source-connectorSet connector nameConnector identified as 'my-source-connector'
2connector.classFileStreamSourceSpecify connector typeConnector will read from a file source
3tasks.max1Set max tasksOnly one task will run for this connector
4file/tmp/input.txtSet input file pathConnector reads data from '/tmp/input.txt'
5topicmy-topicSet Kafka topicData will be sent to 'my-topic'
6Deploy-Deploy connector with above configConnector starts running and transferring data
7Run-Connector reads file and sends dataData appears in Kafka topic 'my-topic'
8--End of configuration and deploymentConnector active and working
💡 Connector deployed and running; configuration complete.
Status Tracker
Config KeyInitialAfter Step 1After Step 2After Step 3After Step 4After Step 5Final
nameundefinedmy-source-connectormy-source-connectormy-source-connectormy-source-connectormy-source-connectormy-source-connector
connector.classundefinedundefinedFileStreamSourceFileStreamSourceFileStreamSourceFileStreamSourceFileStreamSource
tasks.maxundefinedundefinedundefined1111
fileundefinedundefinedundefinedundefined/tmp/input.txt/tmp/input.txt/tmp/input.txt
topicundefinedundefinedundefinedundefinedundefinedmy-topicmy-topic
Key Moments - 3 Insights
Why do we need to specify 'connector.class' in the configuration?
The 'connector.class' tells Kafka Connect what type of connector to run, as shown in step 2 of the execution_table. Without it, Kafka Connect won't know how to handle the data source.
What happens if 'tasks.max' is set to more than 1?
Setting 'tasks.max' to more than 1 allows multiple tasks to run in parallel, increasing throughput. In the execution_table at step 3, it is set to 1, meaning only one task runs.
How does the connector know where to send the data?
The 'topic' config key (step 5) tells the connector which Kafka topic to send data to. Without this, data would have no destination.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the value of 'file' after step 4?
A"my-topic"
B"/tmp/input.txt"
C"FileStreamSource"
D"my-source-connector"
💡 Hint
Check the 'Value' column at step 4 in the execution_table.
At which step does the connector start running and transferring data?
AStep 3
BStep 5
CStep 6
DStep 2
💡 Hint
Look for the 'Action' column mentioning deployment in the execution_table.
If we change 'tasks.max' to 3, what will change in the variable_tracker?
A'tasks.max' will show '3' after step 3 and onwards
B'connector.class' will change to '3'
C'file' will change to '3'
D'name' will change to '3'
💡 Hint
Look at the 'tasks.max' row in variable_tracker and imagine changing its value.
Concept Snapshot
Connector configuration in Kafka Connect:
- Define JSON with keys like 'name', 'connector.class', 'tasks.max', 'file', 'topic'
- 'name' identifies the connector
- 'connector.class' specifies connector type
- 'tasks.max' controls parallelism
- 'file' or other source config sets input
- 'topic' sets Kafka destination
- Deploy config to start connector
Full Transcript
This visual execution shows how to configure a Kafka connector step-by-step. We start by setting the connector name, then specify the connector class to tell Kafka Connect what type of connector to run. Next, we set the maximum number of tasks to control parallelism. Then, we provide connection details like the input file path and the Kafka topic to send data to. After applying all settings, we deploy the connector, which then runs and transfers data from the source to the Kafka topic. The variable tracker shows how each configuration key is set over time. Key moments clarify why each setting is important. The quiz tests understanding of configuration values and deployment steps.