T
- the expected typepublic interface DeserializationFailureHandler<T>
Implementors must use @Identifier
to provide a name to the bean.
This name is then referenced in the channel configuration:
mp.messaging.incoming.my-channel.[key|value]-deserialization-failure-handler=name
.
When a Kafka Record's key or value cannot be deserialized, this bean is called to provide a fallback value.
null
is an accepted fallback value.
If this bean throws an exception, this is considered as a fatal failure and the application is reported unhealthy.
Modifier and Type | Method and Description |
---|---|
default T |
handleDeserializationFailure(String topic,
boolean isKey,
String deserializer,
byte[] data,
Exception exception,
org.apache.kafka.common.header.Headers headers)
Handles a deserialization issue for a record's key or value.
|
default T handleDeserializationFailure(String topic, boolean isKey, String deserializer, byte[] data, Exception exception, org.apache.kafka.common.header.Headers headers)
topic
- the topicisKey
- whether the failure happened when deserializing a record's key.deserializer
- the used deserializerdata
- the data that was not deserialized correctlyexception
- the exceptionheaders
- the record headers, extended with the failure reason, causes, and data. May also be null
T
Copyright © 2018–2021 SmallRye. All rights reserved.