Class AvroRecordCodec<T extends Record>

java.lang.Object
org.nuxeo.runtime.codec.AvroRecordCodec<T>
All Implemented Interfaces:
Codec<T>

public class AvroRecordCodec<T extends Record> extends Object implements Codec<T>
Instead of having an Avro Record envelop that contains a data encoded in Avro, this structure is a flat Avro message joining schemas of the Record and data. This encoding can then be read by any Confluent Avro reader.
Since:
11.4
  • Field Details

    • NAME

      public static final String NAME
      See Also:
    • RECORD_KEY

      public static final String RECORD_KEY
      See Also:
    • RECORD_WATERMARK

      public static final String RECORD_WATERMARK
      See Also:
    • RECORD_TIMESTAMP

      public static final String RECORD_TIMESTAMP
      See Also:
    • RECORD_FLAGS

      public static final String RECORD_FLAGS
      See Also:
    • schema

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

      protected final int schemaId
    • messageSchema

      protected final org.apache.avro.Schema messageSchema
    • messageSchemaId

      protected final int messageSchemaId
    • messageDecoder

      protected final org.apache.avro.message.RawMessageDecoder<org.apache.avro.generic.GenericRecord> messageDecoder
    • messageEncoder

      protected final org.apache.avro.message.RawMessageEncoder<org.apache.avro.generic.GenericRecord> messageEncoder
    • serializer

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

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

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

  • Method Details

    • getName

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

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

      protected org.apache.avro.generic.GenericRecord createRecordFromMessage(org.apache.avro.generic.GenericRecord message)
    • addRecordFieldsToSchema

      protected org.apache.avro.Schema addRecordFieldsToSchema(org.apache.avro.Schema schema)
    • 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 extends Record>