Class DeserializerWrapper<T>
- java.lang.Object
-
- io.smallrye.reactive.messaging.kafka.fault.DeserializerWrapper<T>
-
- Type Parameters:
T
- the type of object created by the deserializer.
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.kafka.common.serialization.Deserializer<T>
public class DeserializerWrapper<T> extends Object implements org.apache.kafka.common.serialization.Deserializer<T>
Wraps a delegate deserializer to handle config and deserialization failures.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DESERIALIZATION_FAILURE_CAUSE
Header name for deserialization failure cause if any.static String
DESERIALIZATION_FAILURE_DATA
Header name passing the data that was not able to be deserialized.static String
DESERIALIZATION_FAILURE_DESERIALIZER
Header name passing the class name of the underlying deserializer.static String
DESERIALIZATION_FAILURE_IS_KEY
Header name used when the deserialization failure happened on a key.static String
DESERIALIZATION_FAILURE_REASON
Header name for deserialization failure message.static String
DESERIALIZATION_FAILURE_TOPIC
Header name for the topic of the incoming message when a deserialization failure happen.
-
Constructor Summary
Constructors Constructor Description DeserializerWrapper(String className, boolean key, DeserializationFailureHandler<T> failureHandler, KafkaSource<?,?> source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
configure(Map<String,?> configs, boolean isKey)
Delegates to the underlying deserializer instance.T
deserialize(String topic, byte[] data)
T
deserialize(String topic, org.apache.kafka.common.header.Headers headers, byte[] data)
-
-
-
Field Detail
-
DESERIALIZATION_FAILURE_REASON
public static final String DESERIALIZATION_FAILURE_REASON
Header name for deserialization failure message.- See Also:
- Constant Field Values
-
DESERIALIZATION_FAILURE_CAUSE
public static final String DESERIALIZATION_FAILURE_CAUSE
Header name for deserialization failure cause if any.- See Also:
- Constant Field Values
-
DESERIALIZATION_FAILURE_IS_KEY
public static final String DESERIALIZATION_FAILURE_IS_KEY
Header name used when the deserialization failure happened on a key. The value is"true"
in this case, absent otherwise.- See Also:
- Constant Field Values
-
DESERIALIZATION_FAILURE_TOPIC
public static final String DESERIALIZATION_FAILURE_TOPIC
Header name for the topic of the incoming message when a deserialization failure happen.- See Also:
- Constant Field Values
-
DESERIALIZATION_FAILURE_DATA
public static final String DESERIALIZATION_FAILURE_DATA
Header name passing the data that was not able to be deserialized.- See Also:
- Constant Field Values
-
DESERIALIZATION_FAILURE_DESERIALIZER
public static final String DESERIALIZATION_FAILURE_DESERIALIZER
Header name passing the class name of the underlying deserializer.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DeserializerWrapper
public DeserializerWrapper(String className, boolean key, DeserializationFailureHandler<T> failureHandler, KafkaSource<?,?> source)
-
-
Method Detail
-
configure
public void configure(Map<String,?> configs, boolean isKey)
Delegates to the underlying deserializer instance.- Specified by:
configure
in interfaceorg.apache.kafka.common.serialization.Deserializer<T>
- Parameters:
configs
- the configurationisKey
- the key
-
deserialize
public T deserialize(String topic, byte[] data)
- Specified by:
deserialize
in interfaceorg.apache.kafka.common.serialization.Deserializer<T>
-
deserialize
public T deserialize(String topic, org.apache.kafka.common.header.Headers headers, byte[] data)
- Specified by:
deserialize
in interfaceorg.apache.kafka.common.serialization.Deserializer<T>
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceorg.apache.kafka.common.serialization.Deserializer<T>
-
-