Bird
Raised Fist0
Kafkadevops~20 mins

Sink connectors in Kafka - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Kafka Sink Connector Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate
2:00remaining
What is the output of this Kafka Connect sink connector configuration?
Given the following sink connector configuration snippet, what will be the value of the topics property after parsing?
Kafka
{
  "name": "my-sink-connector",
  "config": {
    "connector.class": "FileStreamSink",
    "tasks.max": "1",
    "topics": "topic1,topic2,topic3",
    "file": "/tmp/output.txt"
  }
}
A["topic1 topic2 topic3"]
B["topic1", "topic2", "topic3"]
Cnull
D"topic1,topic2,topic3"
Attempts:
2 left
💡 Hint
The topics property is a string listing topics separated by commas.
🧠 Conceptual
intermediate
1:30remaining
Which option best describes the role of a Kafka Sink Connector?
What is the main purpose of a Kafka Sink Connector in Kafka Connect?
ATo read data from external systems and write it into Kafka topics.
BTo monitor Kafka broker health and performance.
CTo read data from Kafka topics and write it into external systems.
DTo manage Kafka cluster configurations automatically.
Attempts:
2 left
💡 Hint
Sink connectors move data out of Kafka.
🔧 Debug
advanced
2:30remaining
Identify the error in this sink connector configuration snippet
This sink connector configuration is intended to write Kafka topic data to a file. What error will it cause?
Kafka
{
  "name": "file-sink",
  "config": {
    "connector.class": "FileStreamSink",
    "tasks.max": 1,
    "topics": ["my-topic"],
    "file": "/tmp/output.log"
  }
}
ARuntime error because 'tasks.max' must be a string
BSyntaxError due to JSON array in 'topics' property
CNo error; configuration is valid
DConfiguration error because 'file' path is invalid
Attempts:
2 left
💡 Hint
The 'topics' property expects a string, not an array.
📝 Syntax
advanced
2:00remaining
Which option correctly defines a sink connector with exactly 3 tasks?
Select the valid JSON snippet that sets up a sink connector with 3 parallel tasks.
A{ "name": "sink-connector", "config": { "connector.class": "JdbcSinkConnector", "tasks.max": "3", "topics": "orders", "connection.url": "jdbc:mysql://localhost:3306/shop" } }
B{ "name": "sink-connector", "config": { "connector.class": "JdbcSinkConnector", "tasks.max": 3, "topics": "orders", "connection.url": "jdbc:mysql://localhost:3306/shop" } }
C{ "name": "sink-connector", "config": { "connector.class": "JdbcSinkConnector", "tasks.max": "three", "topics": "orders", "connection.url": "jdbc:mysql://localhost:3306/shop" } }
D{ "name": "sink-connector", "config": { "connector.class": "JdbcSinkConnector", "tasks.max": "3 tasks", "topics": "orders", "connection.url": "jdbc:mysql://localhost:3306/shop" } }
Attempts:
2 left
💡 Hint
The 'tasks.max' property must be a string representing a number.
🚀 Application
expert
3:00remaining
How many tasks will run for this sink connector configuration?
Consider this sink connector config: { "name": "multi-task-sink", "config": { "connector.class": "FileStreamSink", "tasks.max": "5", "topics": "topicA,topicB" } } If the Kafka Connect cluster has only 3 worker nodes available, how many tasks will actually run?
AOnly 1 task will run because FileStreamSink supports a single task.
B5 tasks will run, distributed across the 3 workers.
C3 tasks will run, limited by the number of available workers.
DNo tasks will run due to configuration conflict.
Attempts:
2 left
💡 Hint
Some connectors limit the number of tasks regardless of 'tasks.max'.

Practice

(1/5)
1.

What is the main purpose of a Kafka sink connector?

easy
A. To create new Kafka topics dynamically
B. To move data from external systems into Kafka topics
C. To monitor Kafka cluster health
D. To move data from Kafka topics to external systems automatically

Solution

  1. Step 1: Understand the role of sink connectors

    Sink connectors are designed to export data from Kafka topics to other systems.
  2. Step 2: Differentiate from source connectors

    Source connectors import data into Kafka, while sink connectors export data out.
  3. Final Answer:

    To move data from Kafka topics to external systems automatically -> Option D
  4. Quick Check:

    Sink connector = export data from Kafka [OK]
Hint: Sink connectors export data out of Kafka topics [OK]
Common Mistakes:
  • Confusing sink with source connectors
  • Thinking sink connectors create topics
  • Assuming sink connectors monitor Kafka health
2.

Which of the following is a correct JSON field to specify the Kafka topic for a sink connector configuration?

{
  "name": "my-sink-connector",
  "config": {
    "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
    "topics": "my_topic",
    "connection.url": "jdbc:mysql://localhost:3306/mydb"
  }
}
easy
A. "topics"
B. "topic"
C. "topic_name"
D. "source.topics"

Solution

  1. Step 1: Check the standard Kafka Connect config field

    The field to specify Kafka topics in sink connector config is "topics" (plural).
  2. Step 2: Verify the example JSON

    The example uses "topics": "my_topic", which is correct syntax.
  3. Final Answer:

    "topics" -> Option A
  4. Quick Check:

    Kafka sink config uses "topics" field [OK]
Hint: Use "topics" (plural) to list Kafka topics in config [OK]
Common Mistakes:
  • Using "topic" (singular) instead of "topics"
  • Using non-standard fields like "topic_name"
  • Confusing source connector fields with sink
3.

Given this sink connector config snippet, what will be the destination system?

{
  "name": "file-sink-connector",
  "config": {
    "connector.class": "FileStreamSink",
    "topics": "logs",
    "file": "/tmp/output.log"
  }
}
medium
A. A Kafka topic named 'logs'
B. A file located at /tmp/output.log
C. A database table named 'logs'
D. A remote HTTP endpoint

Solution

  1. Step 1: Identify the connector class

    The connector class is "FileStreamSink", which writes data to a file.
  2. Step 2: Check the "file" config field

    The "file" field specifies the destination file path "/tmp/output.log".
  3. Final Answer:

    A file located at /tmp/output.log -> Option B
  4. Quick Check:

    FileStreamSink writes to file path [OK]
Hint: FileStreamSink writes Kafka data to a file path [OK]
Common Mistakes:
  • Assuming data goes back to Kafka topic
  • Confusing sink with source connectors
  • Thinking it writes to a database or HTTP
4.

Identify the error in this sink connector config JSON:

{
  "name": "jdbc-sink",
  "config": {
    "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
    "topic": "orders",
    "connection.url": "jdbc:postgresql://localhost:5432/shop"
  }
}
medium
A. Invalid JDBC URL format
B. Connector class name is incorrect
C. Missing 'topics' field; uses 'topic' instead
D. Missing 'name' field

Solution

  1. Step 1: Check the topic field name

    The config uses "topic" (singular), but Kafka sink connectors require "topics" (plural).
  2. Step 2: Verify other fields

    The JDBC URL and connector class are correctly formatted, and "name" is present.
  3. Final Answer:

    Missing 'topics' field; uses 'topic' instead -> Option C
  4. Quick Check:

    Use "topics" not "topic" in sink config [OK]
Hint: Use plural "topics" field in sink connector config [OK]
Common Mistakes:
  • Using singular "topic" instead of "topics"
  • Assuming JDBC URL is wrong without checking
  • Thinking connector class name is invalid
5.

You want to export data from multiple Kafka topics to a single database table using a JDBC sink connector. Which configuration approach is correct?

{
  "name": "multi-topic-jdbc-sink",
  "config": {
    "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
    "topics": "topic1,topic2,topic3",
    "connection.url": "jdbc:mysql://localhost:3306/mydb",
    "table.name.format": "combined_table"
  }
}
hard
A. This config exports all topics to one table named 'combined_table'
B. Each topic will create a separate table ignoring 'table.name.format'
C. The connector will fail because multiple topics are not allowed
D. Data will be merged but only from 'topic1'

Solution

  1. Step 1: Understand 'topics' field with multiple topics

    The "topics" field lists multiple topics separated by commas, which is valid.
  2. Step 2: Check 'table.name.format' usage

    Setting "table.name.format" to a fixed table name causes all data to go into that single table.
  3. Step 3: Confirm connector behavior

    The JDBC sink connector supports writing multiple topics to one table if configured this way.
  4. Final Answer:

    This config exports all topics to one table named 'combined_table' -> Option A
  5. Quick Check:

    Multiple topics + fixed table name = single table export [OK]
Hint: Use comma-separated topics and fixed table name for single table export [OK]
Common Mistakes:
  • Assuming multiple topics create separate tables automatically
  • Thinking multiple topics are not allowed in sink config
  • Ignoring 'table.name.format' effect
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard