Recall & Review
beginner
What is the main role of a Java Kafka consumer client?
A Java Kafka consumer client reads messages from Kafka topics, allowing applications to process data streams in real time.
Click to reveal answer
beginner
Which method in the KafkaConsumer class is used to subscribe to topics?The
subscribe() method is used to tell the consumer which topics to listen to.Click to reveal answer
beginner
What does the
poll() method do in a Kafka consumer?The
poll() method fetches records from the subscribed topics. It waits for new data and returns a batch of records.Click to reveal answer
intermediate
Why is it important to commit offsets in a Kafka consumer?
Committing offsets tells Kafka which messages have been processed, so the consumer can resume from the right place after a restart.
Click to reveal answer
beginner
What configuration property sets the Kafka server address in a Java consumer client?
The
bootstrap.servers property specifies the Kafka broker addresses the consumer connects to.Click to reveal answer
Which method do you use to start receiving messages from Kafka topics in a Java consumer?
✗ Incorrect
The poll() method fetches messages from Kafka topics. subscribe() only tells the consumer which topics to listen to.
What does the
group.id configuration property define in a Kafka consumer?✗ Incorrect
group.id defines the consumer group, which allows multiple consumers to share the work of reading from topics.
How does a Kafka consumer know where to resume reading after a restart?
✗ Incorrect
Committing offsets saves the position of the last processed message so the consumer can resume correctly.
Which of these is NOT a valid Kafka consumer configuration property?
✗ Incorrect
poll.interval is not a standard Kafka consumer config. The others are required to connect and deserialize messages.
What type of object does the poll() method return in a Kafka consumer?
✗ Incorrect
poll() returns a ConsumerRecords object containing the fetched messages.
Explain the basic steps to create and run a Java Kafka consumer client.
Think about how the consumer connects, listens, and remembers progress.
You got /5 concepts.
Describe why committing offsets is important in Kafka consumer clients and how it affects message processing.
Consider what happens if the consumer crashes and restarts.
You got /4 concepts.