Bird
0
0

Which of the following is the correct syntax to create a Kafka consumer with manual commit in Java?

easy📝 Syntax Q3 of 15
Kafka - Advanced Stream Processing
Which of the following is the correct syntax to create a Kafka consumer with manual commit in Java?
Aconsumer.manualCommit();
Bconsumer.commitAsync();
Cconsumer.commit();
Dconsumer.commitSync();
Step-by-Step Solution
Solution:
  1. Step 1: Recall Kafka consumer commit methods

    Kafka Java consumer supports commitSync() and commitAsync() for manual commits.
  2. Step 2: Identify correct method for manual commit

    commitSync() is the synchronous manual commit method.
  3. Final Answer:

    consumer.commitSync(); -> Option D
  4. Quick Check:

    Manual commit syntax = commitSync() [OK]
Quick Trick: Use commitSync() for manual synchronous commits [OK]
Common Mistakes:
MISTAKES
  • Using commit() which does not exist
  • Confusing commitAsync() with synchronous commit
  • Assuming manualCommit() is valid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes