Confluent
CCDAK · Question #139
When is the onCompletion() method called? private class ProducerCallback implements Callback { @Override public void onCompletion(RecordMetadata recordMetadata, Exception e) { if (e != null) {
The correct answer is C. When the broker response is received. Callback is invoked when a broker response is received.
Developing Kafka Producers
Question
When is the onCompletion() method called? private class ProducerCallback implements Callback { @Override public void onCompletion(RecordMetadata recordMetadata, Exception e) { if (e != null) {
Options
- AWhen the message is partitioned and batched successfully
- BWhen message is serialized successfully
- CWhen the broker response is received
- DWhen send() method is called
How the community answered
(46 responses)- A2% (1)
- B4% (2)
- C91% (42)
- D2% (1)
Explanation
Callback is invoked when a broker response is received.
Topics
#producer callback#onCompletion#async send#broker acknowledgment
Community Discussion
No community discussion yet for this question.