Apache Kafka Kafka Connect 2 — Questions and Answers
Question 1: Which Kafka Connect SMT would you use to add a current timestamp field to every record?
- InsertField with timestamp=true (Correct answer)
- ReplaceField
- MaskField
- ExtractField
Correct answer: InsertField with timestamp=true
The InsertField SMT with timestamp=true appends a wall-clock timestamp field to every record passing through the connector.
Question 2: What does the Kafka Connect 'offset storage topic' store?
- The read positions (offsets) of source connectors so they can resume after restart (Correct answer)
- Consumer group offsets for sink connectors
- Schema Registry offsets
- Broker log segment positions
Correct answer: The read positions (offsets) of source connectors so they can resume after restart
Connect stores source connector offsets (e.g., the last processed database row ID) in this internal topic to enable exactly-once or at-least-once resumption.
Question 3: What HTTP endpoint checks the status of a running connector in Kafka Connect's REST API?
- GET /connectors/{name}/status (Correct answer)
- GET /connectors/{name}/tasks
- POST /connectors/{name}/restart
- PUT /connectors/{name}/config
Correct answer: GET /connectors/{name}/status
GET /connectors/{name}/status returns the current state of the connector and each of its tasks (RUNNING, PAUSED, FAILED, etc.).
Question 4: What is the 'config storage topic' used for in Kafka Connect distributed mode?
- Stores all connector and task configurations so workers share a consistent view (Correct answer)
- Holds Kafka broker configurations
- Caches SMT transformation results
- Stores schema evolution history
Correct answer: Stores all connector and task configurations so workers share a consistent view
The config storage topic persists connector configurations across all workers, ensuring every worker in the Connect cluster has the same configuration state.
Question 5: Which configuration key in a JDBC source connector controls how frequently new rows are polled from the database?
- poll.interval.ms (Correct answer)
- batch.max.rows
- query.suffix
- db.timezone
Correct answer: poll.interval.ms
poll.interval.ms determines the frequency (in milliseconds) at which the JDBC source connector queries the database for new or updated rows.
Question 6: What happens to a failed Connect task if you POST to `/connectors/{name}/tasks/{taskId}/restart`?
- The specific task is restarted and attempts to resume from its last stored offset (Correct answer)
- The entire connector is recreated
- The worker hosting the task is rebooted
- A new connector with a fresh offset is created
Correct answer: The specific task is restarted and attempts to resume from its last stored offset
Restarting an individual task via the REST API causes that task to reinitialize and resume data copying from the last committed offset.
Which Kafka Connect SMT would you use to add a current timestamp field to every record?