Class AbstractMultiVersionReader<T>

java.lang.Object
org.apache.pulsar.client.impl.schema.reader.AbstractMultiVersionReader<T>
All Implemented Interfaces:
org.apache.pulsar.client.api.schema.SchemaReader<T>
Direct Known Subclasses:
AbstractMultiVersionAvroBaseReader, MultiVersionGenericProtobufNativeReader

public abstract class AbstractMultiVersionReader<T> extends Object implements org.apache.pulsar.client.api.schema.SchemaReader<T>
The multi version reader abstract class, implement it will handle the multi version schema.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final org.slf4j.Logger
     
    protected final org.apache.pulsar.client.api.schema.SchemaReader<T>
     
    protected org.apache.pulsar.client.api.schema.SchemaInfoProvider
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractMultiVersionReader(org.apache.pulsar.client.api.schema.SchemaReader<T> providerSchemaReader)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.apache.pulsar.common.schema.SchemaInfo
    getSchemaInfoByVersion(byte[] schemaVersion)
    TODO: think about how to make this async.
    org.apache.pulsar.client.api.schema.SchemaReader<T>
    getSchemaReader(byte[] schemaVersion)
     
    protected abstract org.apache.pulsar.client.api.schema.SchemaReader<T>
    loadReader(org.apache.pulsar.common.protocol.schema.BytesSchemaVersion schemaVersion)
    Load the schema reader for reading messages encoded by the given schema version.
    read(byte[] bytes, byte[] schemaVersion)
     
    read(byte[] bytes, int offset, int length)
     
    read(InputStream inputStream)
     
    read(InputStream inputStream, byte[] schemaVersion)
     
    void
    setSchemaInfoProvider(org.apache.pulsar.client.api.schema.SchemaInfoProvider schemaInfoProvider)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.pulsar.client.api.schema.SchemaReader

    getNativeSchema, read
  • Field Details

    • providerSchemaReader

      protected final org.apache.pulsar.client.api.schema.SchemaReader<T> providerSchemaReader
    • schemaInfoProvider

      protected org.apache.pulsar.client.api.schema.SchemaInfoProvider schemaInfoProvider
    • LOG

      protected static final org.slf4j.Logger LOG
  • Constructor Details

    • AbstractMultiVersionReader

      public AbstractMultiVersionReader(org.apache.pulsar.client.api.schema.SchemaReader<T> providerSchemaReader)
  • Method Details

    • read

      public T read(byte[] bytes, int offset, int length)
      Specified by:
      read in interface org.apache.pulsar.client.api.schema.SchemaReader<T>
    • read

      public T read(InputStream inputStream)
      Specified by:
      read in interface org.apache.pulsar.client.api.schema.SchemaReader<T>
    • read

      public T read(InputStream inputStream, byte[] schemaVersion)
      Specified by:
      read in interface org.apache.pulsar.client.api.schema.SchemaReader<T>
    • getSchemaReader

      public org.apache.pulsar.client.api.schema.SchemaReader<T> getSchemaReader(byte[] schemaVersion) throws ExecutionException
      Throws:
      ExecutionException
    • read

      public T read(byte[] bytes, byte[] schemaVersion)
      Specified by:
      read in interface org.apache.pulsar.client.api.schema.SchemaReader<T>
    • setSchemaInfoProvider

      public void setSchemaInfoProvider(org.apache.pulsar.client.api.schema.SchemaInfoProvider schemaInfoProvider)
      Specified by:
      setSchemaInfoProvider in interface org.apache.pulsar.client.api.schema.SchemaReader<T>
    • loadReader

      protected abstract org.apache.pulsar.client.api.schema.SchemaReader<T> loadReader(org.apache.pulsar.common.protocol.schema.BytesSchemaVersion schemaVersion)
      Load the schema reader for reading messages encoded by the given schema version.
      Parameters:
      schemaVersion - the provided schema version
      Returns:
      the schema reader for decoding messages encoded by the provided schema version.
    • getSchemaInfoByVersion

      protected org.apache.pulsar.common.schema.SchemaInfo getSchemaInfoByVersion(byte[] schemaVersion)
      TODO: think about how to make this async.