Class WrappedNoSerializationErrorDeserializer<T>

java.lang.Object
org.sdase.commons.server.kafka.serializers.WrappedNoSerializationErrorDeserializer<T>
Type Parameters:
T - class to deserialize
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.kafka.common.serialization.Deserializer<T>

public class WrappedNoSerializationErrorDeserializer<T> extends Object implements org.apache.kafka.common.serialization.Deserializer<T>
A simple helper that delegates all deserialization calls to the wrapped deserializer given in the constructor. Potential deserialization exceptions are caught, logged and null value is returned. This helper can be used to workaround a known Kafka problem, see https://issues.apache.org/jira/browse/KAFKA-4740.
  • Constructor Details

    • WrappedNoSerializationErrorDeserializer

      public WrappedNoSerializationErrorDeserializer(org.apache.kafka.common.serialization.Deserializer<T> deserializer)
  • Method Details

    • configure

      public void configure(Map<String,?> configs, boolean isKey)
      Specified by:
      configure in interface org.apache.kafka.common.serialization.Deserializer<T>
    • deserialize

      public T deserialize(String topic, byte[] data)
      Specified by:
      deserialize in interface org.apache.kafka.common.serialization.Deserializer<T>
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.apache.kafka.common.serialization.Deserializer<T>