Class NativeAvroBytesSchema<T>

java.lang.Object
org.apache.pulsar.client.impl.schema.NativeAvroBytesSchema<T>
All Implemented Interfaces:
Cloneable, Schema<byte[]>

public class NativeAvroBytesSchema<T> extends Object implements Schema<byte[]>
Schema from a native Apache Avro schema. This class is supposed to be used on the producer side for working with existing data serialized in Avro, possibly stored in another system like Kafka. For this reason, it will not perform bytes validation against the schema in encoding and decoding, which are just identify functions. This class also makes it possible for users to bring in their own Avro serialization method.
  • Constructor Details

    • NativeAvroBytesSchema

      public NativeAvroBytesSchema(org.apache.avro.Schema schema)
    • NativeAvroBytesSchema

      public NativeAvroBytesSchema(Object schema)
  • Method Details

    • setSchema

      public void setSchema(org.apache.avro.Schema schema)
    • schemaInitialized

      public boolean schemaInitialized()
    • encode

      public byte[] encode(byte[] message)
      Specified by:
      encode in interface Schema<T>
    • decode

      public byte[] decode(byte[] bytes, byte[] schemaVersion)
      Specified by:
      decode in interface Schema<T>
    • getSchemaInfo

      public SchemaInfo getSchemaInfo()
      Specified by:
      getSchemaInfo in interface Schema<T>
    • getNativeSchema

      public Optional<Object> getNativeSchema()
      Specified by:
      getNativeSchema in interface Schema<T>
    • clone

      public Schema<byte[]> clone()
      Specified by:
      clone in interface Schema<T>
      Overrides:
      clone in class Object