Class BatchListenerFailedException

All Implemented Interfaces:
Serializable

public class BatchListenerFailedException extends KafkaException
An exception thrown by user code to inform the framework which record in a batch has failed.
Since:
2.5
Author:
Gary Russell
See Also:
  • Constructor Details

    • BatchListenerFailedException

      public BatchListenerFailedException(String message, int index)
      Construct an instance with the provided properties.
      Parameters:
      message - the message.
      index - the index in the batch of the failed record.
    • BatchListenerFailedException

      public BatchListenerFailedException(String message, @Nullable Throwable cause, int index)
      Construct an instance with the provided properties.
      Parameters:
      message - the message.
      cause - the cause.
      index - the index in the batch of the failed record.
    • BatchListenerFailedException

      public BatchListenerFailedException(String message, org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record)
      Construct an instance with the provided properties.
      Parameters:
      message - the message.
      record - the failed record.
    • BatchListenerFailedException

      public BatchListenerFailedException(String message, @Nullable Throwable cause, org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record)
      Construct an instance with the provided properties.
      Parameters:
      message - the message.
      cause - the cause.
      record - the failed record.
  • Method Details

    • getRecord

      @Nullable public org.apache.kafka.clients.consumer.ConsumerRecord<?,?> getRecord()
      Return the failed record.
      Returns:
      the record.
    • getIndex

      public int getIndex()
      Return the index in the batch of the failed record.
      Returns:
      the index.
    • getMessage

      public String getMessage()
      Overrides:
      getMessage in class Throwable