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:
Serializable
Exception returned in the consumer record value or key when a deserialization failure
occurs.
- Since:
- 2.2
- Author:
- Gary Russell, Artem Bilan
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.kafka.KafkaException
KafkaException.Level
-
Constructor Summary
ConstructorDescriptionDeserializationException
(String message, byte[] data, boolean isKey, Throwable cause) Construct an instance with the provided properties. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
getData()
Get the data that failed deserialization (value or key).org.apache.kafka.common.header.Headers
Get the headers.boolean
isKey()
True if deserialization of the key failed, otherwise deserialization of the value failed.void
setHeaders
(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, getMostSpecificCause, getRootCause
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
DeserializationException
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
Get the headers.- Returns:
- the headers.
-
setHeaders
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.
-