public interface Callback
Modifier and Type | Method and Description |
---|---|
void |
onCompletion(RecordMetadata metadata,
Exception exception)
A callback method the user can implement to provide asynchronous handling of request completion.
|
void onCompletion(RecordMetadata metadata, Exception exception)
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.exception
- The exception thrown during processing of this record. Null if no error occurred.
Possible thrown exceptions include:
Non-Retriable exceptions (fatal, the message will never be sent):
InvalidTopicException
OffsetMetadataTooLargeException
RecordBatchTooLargeException
RecordTooLargeException
UnknownServerException
UnknownProducerIdException
InvalidProducerEpochException
Retriable exceptions (transient, may be covered by increasing #.retries):
CorruptRecordException
InvalidMetadataException
NotEnoughReplicasAfterAppendException
NotEnoughReplicasException
OffsetOutOfRangeException
TimeoutException
UnknownTopicOrPartitionException