0
0
Kafkadevops~10 mins

Kafka Connect architecture - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a Kafka Connect source connector class.

Kafka
public class MySourceConnector extends [1] { }
Drag options to blanks, or click blank then click option'
AKafkaProducer
BSinkConnector
CConnectorConfig
DSourceConnector
Attempts:
3 left
💡 Hint
Common Mistakes
Using SinkConnector instead of SourceConnector
Extending KafkaProducer which is unrelated to connectors
2fill in blank
medium

Complete the code to start the Kafka Connect worker with the correct configuration.

Kafka
Worker worker = new Worker("worker1", config, [1]);
Drag options to blanks, or click blank then click option'
Aherder
Bnull
Cconnector
Dproducer
Attempts:
3 left
💡 Hint
Common Mistakes
Passing null instead of herder
Passing unrelated objects like producer or connector
3fill in blank
hard

Fix the error in the connector configuration property key.

Kafka
props.put("[1]", "my-connector");
Drag options to blanks, or click blank then click option'
Aname
Bconnector.name
Cconnector.class
Dconnector.id
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'connector.name' which is invalid
Using 'connector.id' which is not a valid property
4fill in blank
hard

Fill both blanks to create a task configuration map with the correct keys.

Kafka
Map<String, String> taskConfig = new HashMap<>();
taskConfig.put("[1]", "my-task");
taskConfig.put("[2]", "com.example.MyTask");
Drag options to blanks, or click blank then click option'
Atask.name
Btask.class
Cname
Dclass
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'task.name' instead of 'name'
Using 'class' instead of 'task.class'
5fill in blank
hard

Fill all three blanks to complete the connector's taskConfigs method.

Kafka
public List<Map<String, String>> taskConfigs(int maxTasks) {
    List<Map<String, String>> configs = new ArrayList<>();
    for (int i = 0; i < [1]; i++) {
        Map<String, String> config = new HashMap<>();
        config.put("[2]", "task-" + i);
        config.put("[3]", this.config.get("connector.class"));
        configs.add(config);
    }
    return configs;
}
Drag options to blanks, or click blank then click option'
AmaxTasks
Bname
Ctask.class
DmaxTaskCount
Attempts:
3 left
💡 Hint
Common Mistakes
Using an undefined variable instead of maxTasks
Using wrong keys like 'task.name' or 'class'