Class DeserializationException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.springframework.core.NestedRuntimeException
-
- org.springframework.kafka.KafkaException
-
- org.springframework.kafka.support.serializer.DeserializationException
-
- All Implemented Interfaces:
java.io.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:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.springframework.kafka.KafkaException
KafkaException.Level
-
-
Constructor Summary
Constructors Constructor Description DeserializationException(java.lang.String message, byte[] data, boolean isKey, java.lang.Throwable cause)Construct an instance with the provided properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getData()Get the data that failed deserialization (value or key).org.apache.kafka.common.header.HeadersgetHeaders()Get the headers.booleanisKey()True if deserialization of the key failed, otherwise deserialization of the value failed.voidsetHeaders(org.apache.kafka.common.header.Headers headers)Set the headers.-
Methods inherited from class org.springframework.kafka.KafkaException
selfLog
-
Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getMessage, getMostSpecificCause, getRootCause
-
-
-
-
Constructor Detail
-
DeserializationException
public DeserializationException(java.lang.String message, byte[] data, boolean isKey, java.lang.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 Detail
-
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.
-
-