Class BatchListenerFailedException

  • All Implemented Interfaces:
    java.io.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:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      BatchListenerFailedException​(java.lang.String message, int index)
      Construct an instance with the provided properties.
      BatchListenerFailedException​(java.lang.String message, java.lang.Throwable cause, int index)
      Construct an instance with the provided properties.
      BatchListenerFailedException​(java.lang.String message, java.lang.Throwable cause, org.apache.kafka.clients.consumer.ConsumerRecord<?,​?> record)
      Construct an instance with the provided properties.
      BatchListenerFailedException​(java.lang.String message, org.apache.kafka.clients.consumer.ConsumerRecord<?,​?> record)
      Construct an instance with the provided properties.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getIndex()
      Return the index in the batch of the failed record.
      java.lang.String getMessage()  
      org.apache.kafka.clients.consumer.ConsumerRecord<?,​?> getRecord()
      Return the failed record.
      • Methods inherited from class org.springframework.core.NestedRuntimeException

        contains, getMostSpecificCause, getRootCause
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • BatchListenerFailedException

        public BatchListenerFailedException​(java.lang.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​(java.lang.String message,
                                            @Nullable
                                            java.lang.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​(java.lang.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​(java.lang.String message,
                                            @Nullable
                                            java.lang.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 Detail

      • 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 java.lang.String getMessage()
        Overrides:
        getMessage in class org.springframework.core.NestedRuntimeException