Class AvroConfluentCodec<T>

  • All Implemented Interfaces:
    Codec<T>

    public class AvroConfluentCodec<T>
    extends Object
    implements Codec<T>
    Use the Confluent Avro encoding which differs from Avro message, the schema store is a REST Confluent Schema Registry.
    Since:
    10.3
    • Field Detail

      • DEFAULT_IDENTITY_MAP_CAPACITY

        protected static final int DEFAULT_IDENTITY_MAP_CAPACITY
        See Also:
        Constant Field Values
      • messageClass

        protected final Class<T> messageClass
      • schema

        protected final org.apache.avro.Schema schema
      • schemaId

        protected final int schemaId
      • schemaName

        protected final String schemaName
      • serializer

        protected final io.confluent.kafka.serializers.KafkaAvroSerializer serializer
      • encoder

        protected final org.apache.avro.message.RawMessageEncoder<T> encoder
      • client

        protected final io.confluent.kafka.schemaregistry.client.SchemaRegistryClient client
    • Constructor Detail

      • AvroConfluentCodec

        public AvroConfluentCodec​(Class<T> messageClass,
                                  String schemaRegistryUrls)
        Create an AvroConfluent codec
        Parameters:
        messageClass - the class to encode and decode
        schemaRegistryUrls - a comma separated list of Confluent Schema Registry URL
    • Method Detail

      • getRegistryClient

        public static io.confluent.kafka.schemaregistry.client.SchemaRegistryClient getRegistryClient​(String schemaRegistryUrls)
      • getName

        public String getName()
        Description copied from interface: Codec
        Returns the codec name
        Specified by:
        getName in interface Codec<T>
      • encode

        public byte[] encode​(T object)
        Description copied from interface: Codec
        Encodes the object returns a byte array representation.
        Specified by:
        encode in interface Codec<T>
      • decode

        public T decode​(byte[] data)
        Description copied from interface: Codec
        Decodes the byte array returns an object.
        Specified by:
        decode in interface Codec<T>