Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set the consumer group ID.
Kafka
props.put("group.id", [1]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using configuration keys instead of a group ID string.
Leaving the group.id unset.
✗ Incorrect
The group.id property sets the consumer group identifier, which is required for consumer coordination.
2fill in blank
mediumComplete the code to configure the consumer to automatically commit offsets.
Kafka
props.put("[1]", "true");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing auto.offset.reset with enable.auto.commit.
Setting the wrong property key.
✗ Incorrect
The enable.auto.commit property controls whether the consumer automatically commits offsets.
3fill in blank
hardFix the error in the code to set the offset reset policy to earliest.
Kafka
props.put("auto.offset.reset", [1]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using earliest without quotes causes a syntax error.
Using boolean true instead of a string.
✗ Incorrect
The value must be a string literal "earliest" to set the offset reset policy correctly.
4fill in blank
hardFill both blanks to configure the consumer's key and value deserializers.
Kafka
props.put("key.deserializer", [1]); props.put("value.deserializer", [2]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing different deserializer classes for key and value.
Using deserializers that don't match the data type.
✗ Incorrect
Both key and value deserializers are set to StringDeserializer to read string data.
5fill in blank
hardFill all three blanks to create a consumer configuration that disables auto commit, sets group ID, and sets max poll records.
Kafka
props.put("enable.auto.commit", [1]); props.put("group.id", [2]); props.put("max.poll.records", [3]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using boolean false instead of string "false".
Setting max.poll.records as a number instead of string.
✗ Incorrect
Disabling auto commit requires "false", group ID is a string, and max.poll.records is a string number.