Class DeserializationException

All Implemented Interfaces:
Serializable

public class DeserializationException extends KafkaException
Exception returned in the consumer record value or key when a deserialization failure occurs.
Since:
2.2
Author:
Gary Russell, Artem Bilan
See Also:
  • Constructor Details

    • DeserializationException

      public DeserializationException(String message, byte[] data, boolean isKey, Throwable cause)
      Construct an instance with the provided properties.
      Parameters:
      message - the message.
      data - the data (value or key).
      isKey - true if the exception occurred while deserializing the key.
      cause - the cause.
  • Method Details

    • getHeaders

      @Nullable public org.apache.kafka.common.header.Headers getHeaders()
      Get the headers.
      Returns:
      the headers.
    • setHeaders

      public void setHeaders(@Nullable org.apache.kafka.common.header.Headers headers)
      Set the headers.
      Parameters:
      headers - the headers.
    • getData

      public byte[] getData()
      Get the data that failed deserialization (value or key).
      Returns:
      the data.
    • isKey

      public boolean isKey()
      True if deserialization of the key failed, otherwise deserialization of the value failed.
      Returns:
      true for the key.