Class AvroConfluentCodec<T>

java.lang.Object
org.nuxeo.lib.stream.codec.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 Details

    • NAME

      public static final String NAME
      See Also:
    • MAGIC_BYTE

      public static final byte MAGIC_BYTE
      See Also:
    • ID_SIZE

      public static final int ID_SIZE
      See Also:
    • DEFAULT_IDENTITY_MAP_CAPACITY

      protected static final int DEFAULT_IDENTITY_MAP_CAPACITY
      See Also:
    • 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 Details

    • 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 Details

    • 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>