0
0
Kafkadevops~10 mins

Consumer configuration in Kafka - Interactive Code Practice

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

Complete the code to set the consumer group ID.

Kafka
props.put("group.id", [1]);
Drag options to blanks, or click blank then click option'
A"my-group"
B"localhost"
C"auto.offset.reset"
D"enable.auto.commit"
Attempts:
3 left
💡 Hint
Common Mistakes
Using configuration keys instead of a group ID string.
Leaving the group.id unset.
2fill in blank
medium

Complete 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'
Aenable.auto.commit
Bauto.offset.reset
Cfetch.min.bytes
Dmax.poll.records
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing auto.offset.reset with enable.auto.commit.
Setting the wrong property key.
3fill in blank
hard

Fix 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'
Atrue
Bearliest
C"latest"
D"earliest"
Attempts:
3 left
💡 Hint
Common Mistakes
Using earliest without quotes causes a syntax error.
Using boolean true instead of a string.
4fill in blank
hard

Fill 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'
A"org.apache.kafka.common.serialization.StringDeserializer"
B"org.apache.kafka.common.serialization.IntegerDeserializer"
C"org.apache.kafka.common.serialization.LongDeserializer"
D"org.apache.kafka.common.serialization.ByteArrayDeserializer"
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing different deserializer classes for key and value.
Using deserializers that don't match the data type.
5fill in blank
hard

Fill 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'
A"false"
B"consumer-group-1"
C"500"
D"true"
Attempts:
3 left
💡 Hint
Common Mistakes
Using boolean false instead of string "false".
Setting max.poll.records as a number instead of string.