Class AbstractMultiVersionReader<T>

  • All Implemented Interfaces:
    org.apache.pulsar.client.api.schema.SchemaReader<T>
    Direct Known Subclasses:
    AbstractMultiVersionAvroBaseReader, MultiVersionGenericProtobufNativeReader

    public abstract class AbstractMultiVersionReader<T>
    extends java.lang.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 org.slf4j.Logger LOG  
      protected org.apache.pulsar.client.api.schema.SchemaReader<T> providerSchemaReader  
      protected org.apache.pulsar.client.api.schema.SchemaInfoProvider schemaInfoProvider  
    • Constructor Summary

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

      All Methods Instance Methods Abstract Methods Concrete Methods 
      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.
      T read​(byte[] bytes, byte[] schemaVersion)  
      T read​(byte[] bytes, int offset, int length)  
      T read​(java.io.InputStream inputStream)  
      T read​(java.io.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 Detail

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

      • AbstractMultiVersionReader

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

      • 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​(java.io.InputStream inputStream)
        Specified by:
        read in interface org.apache.pulsar.client.api.schema.SchemaReader<T>
      • read

        public T read​(java.io.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 java.util.concurrent.ExecutionException
        Throws:
        java.util.concurrent.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.