Class ErrorLoggingCallback

java.lang.Object
org.apache.kafka.clients.producer.internals.ErrorLoggingCallback
All Implemented Interfaces:
Callback

public class ErrorLoggingCallback extends Object implements Callback
  • Constructor Details

    • ErrorLoggingCallback

      public ErrorLoggingCallback(String topic, byte[] key, byte[] value, boolean logAsString)
  • Method Details

    • onCompletion

      public void onCompletion(RecordMetadata metadata, Exception e)
      Description copied from 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. When exception is not null in the callback, metadata will contain the special -1 value for all fields. If topicPartition cannot be chosen, a -1 value will be assigned.
      Specified by:
      onCompletion in interface Callback
      Parameters:
      metadata - The metadata for the record that was sent (i.e. the partition and offset). An empty metadata with -1 value for all fields will be returned if an error occurred.
      e - 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
      • OffsetMetadataTooLarge
      • RecordBatchTooLargeException
      • RecordTooLargeException
      • UnknownServerException
      • UnknownProducerIdException
      • InvalidProducerEpochException
      Retriable exceptions (transient, may be covered by increasing #.retries):
      • CorruptRecordException
      • InvalidMetadataException
      • NotEnoughReplicasAfterAppendException
      • NotEnoughReplicasException
      • OffsetOutOfRangeException
      • TimeoutException
      • UnknownTopicOrPartitionException