Q: 8
When is the onCompletion() method called?
private class ProducerCallback implements Callback {
@Override
public void onCompletion(RecordMetadata recordMetadata, Exception e) {
if (e != null) {
e.printStackTrace();
}
}
}
ProducerRecord record =
new ProducerRecord("topic1", "key1", "value1");
producer.send(record, new ProducerCallback());
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.