Class DelegatingDeserializer

java.lang.Object
org.springframework.kafka.support.serializer.DelegatingDeserializer
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.kafka.common.serialization.Deserializer<Object>

public class DelegatingDeserializer extends Object implements org.apache.kafka.common.serialization.Deserializer<Object>
A Deserializer that delegates to other deserializers based on a serialization selector header. It is not necessary to configure standard deserializers supported by Serdes.
Since:
2.3
Author:
Gary Russell
  • Constructor Details

  • Method Details

    • configure

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

      protected static Map<String,org.apache.kafka.common.serialization.Deserializer<?>> createDelegates(String mappings, Map<String,?> configs, boolean isKey)
    • createInstanceAndConfigure

      protected static void createInstanceAndConfigure(Map<String,?> configs, boolean isKey, Map<String,org.apache.kafka.common.serialization.Deserializer<?>> delegateMap, String selector, String className)
    • instantiateAndConfigure

      protected static void instantiateAndConfigure(Map<String,?> configs, boolean isKey, Map<String,org.apache.kafka.common.serialization.Deserializer<?>> delegateMap, String selector, Class<?> clazz)
    • addDelegate

      public void addDelegate(String selector, org.apache.kafka.common.serialization.Deserializer<?> deserializer)
    • removeDelegate

      @Nullable public org.apache.kafka.common.serialization.Deserializer<?> removeDelegate(String selector)
    • deserialize

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

      public Object deserialize(String topic, org.apache.kafka.common.header.Headers headers, byte[] data)
      Specified by:
      deserialize in interface org.apache.kafka.common.serialization.Deserializer<Object>
    • 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<Object>