Skip to content
Snippets Groups Projects
Commit 895c83f8 authored by huxi's avatar huxi Committed by Jun Rao
Browse files

KAFKA-7412: clarify the doc for producer callback (#5798)

The metadata in the callback is not null with non-null exception.

Reviewers: Jun Rao <junrao@gmail.com>
parent eb3335ef
No related branches found
No related tags found
No related merge requests found
......@@ -24,10 +24,11 @@ public interface Callback {
/**
* A callback method the user can implement to provide asynchronous handling of request completion. This method will
* be called when the record sent to the server has been acknowledged. Exactly one of the arguments will be
* non-null.
* @param metadata The metadata for the record that was sent (i.e. the partition and offset). Null if an error
* occurred.
* be called when the record sent to the server has been acknowledged. When exception is not null in the callback,
* metadata will contain the special -1 value for all fields except for topicPartition, which will be valid.
*
* @param metadata The metadata for the record that was sent (i.e. the partition and offset). An empty metadata
* with -1 value for all fields except for topicPartition will be returned if an error occurred.
* @param exception The exception thrown during processing of this record. Null if no error occurred.
* Possible thrown exceptions include:
*
......@@ -49,5 +50,5 @@ public interface Callback {
* TimeoutException
* UnknownTopicOrPartitionException
*/
public void onCompletion(RecordMetadata metadata, Exception exception);
void onCompletion(RecordMetadata metadata, Exception exception);
}
......@@ -81,8 +81,8 @@ class DemoCallBack implements Callback {
/**
* A callback method the user can implement to provide asynchronous handling of request completion. This method will
* be called when the record sent to the server has been acknowledged. Exactly one of the arguments will be
* non-null.
* be called when the record sent to the server has been acknowledged. When exception is not null in the callback,
* metadata will contain the special -1 value for all fields except for topicPartition, which will be valid.
*
* @param metadata The metadata for the record that was sent (i.e. the partition and offset). Null if an error
* occurred.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment