Class JsonSerde<T>

  • Type Parameters:
    T - The object type
    All Implemented Interfaces:
    Closeable, AutoCloseable, org.apache.kafka.common.serialization.Serde<T>

    @Incubating
    public class JsonSerde<T>
    extends Object
    implements org.apache.kafka.common.serialization.Serde<T>
    A Serde that (de-)serializes JSON. The Deserializer supports Debezium's CDC message format, i.e. for such messages the values to be deserialized will be unwrapped from the id field (for keys) or from the after field.
    Author:
    Gunnar Morling, Jiri Pechanec
    • Field Detail

      • mapper

        private final com.fasterxml.jackson.databind.ObjectMapper mapper
      • reader

        private com.fasterxml.jackson.databind.ObjectReader reader
      • isKey

        private boolean isKey
    • Constructor Detail

      • JsonSerde

        public JsonSerde​(Class<T> objectType)
    • Method Detail

      • configure

        public void configure​(Map<String,​?> configs,
                              boolean isKey)
        Specified by:
        configure in interface org.apache.kafka.common.serialization.Serde<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.Serde<T>
      • serializer

        public org.apache.kafka.common.serialization.Serializer<T> serializer()
        Specified by:
        serializer in interface org.apache.kafka.common.serialization.Serde<T>
      • deserializer

        public org.apache.kafka.common.serialization.Deserializer<T> deserializer()
        Specified by:
        deserializer in interface org.apache.kafka.common.serialization.Serde<T>