Interface SchemaResolver

All Known Implementing Classes:
DefaultSchemaResolver

public interface SchemaResolver
Resolves schema to use for message types.
Author:
Chris Bono
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Callback interface that can be implemented by beans wishing to customize the schema resolver before it is fully initialized, in particular to tune its configuration.
  • Method Summary

    Modifier and Type
    Method
    Description
    default <T> Resolved<org.apache.pulsar.client.api.Schema<T>>
    resolveSchema(Class<?> messageType)
    Get the schema to use for a message type.
    <T> Resolved<org.apache.pulsar.client.api.Schema<T>>
    resolveSchema(Class<?> messageType, boolean returnDefault)
    Get the schema to use for a message type.
    default <T> Resolved<org.apache.pulsar.client.api.Schema<T>>
    resolveSchema(org.apache.pulsar.common.schema.SchemaType schemaType, Class<?> messageType, Class<?> messageKeyType)
    Get the schema to use given a schema type and schema type information.
    <T> Resolved<org.apache.pulsar.client.api.Schema<T>>
    resolveSchema(org.apache.pulsar.common.schema.SchemaType schemaType, ResolvableType messageType)
    Get the schema to use given a schema type and a message type.
    default <T> Resolved<org.apache.pulsar.client.api.Schema<T>>
    resolveSchema(T message)
    Get the schema to use for a particular message.
  • Method Details

    • resolveSchema

      default <T> Resolved<org.apache.pulsar.client.api.Schema<T>> resolveSchema(@Nullable T message)
      Get the schema to use for a particular message.
      Type Parameters:
      T - the schema type
      Parameters:
      message - the message instance
      Returns:
      the schema to use or null if no schema could be resolved
    • resolveSchema

      default <T> Resolved<org.apache.pulsar.client.api.Schema<T>> resolveSchema(@Nullable Class<?> messageType)
      Get the schema to use for a message type.
      Type Parameters:
      T - the schema type
      Parameters:
      messageType - the message type
      Returns:
      the schema to use or null if no schema could be resolved
    • resolveSchema

      <T> Resolved<org.apache.pulsar.client.api.Schema<T>> resolveSchema(@Nullable Class<?> messageType, boolean returnDefault)
      Get the schema to use for a message type.
      Type Parameters:
      T - the schema type
      Parameters:
      messageType - the message type
      returnDefault - whether to return default schema if no schema could be resolved
      Returns:
      the schema to use or the default schema if no schema could be resolved and returnDefault is true - otherwise null
    • resolveSchema

      <T> Resolved<org.apache.pulsar.client.api.Schema<T>> resolveSchema(org.apache.pulsar.common.schema.SchemaType schemaType, @Nullable ResolvableType messageType)
      Get the schema to use given a schema type and a message type.
      Type Parameters:
      T - the schema type
      Parameters:
      schemaType - the schema type
      messageType - the message type
      Returns:
      the schema to use
    • resolveSchema

      default <T> Resolved<org.apache.pulsar.client.api.Schema<T>> resolveSchema(org.apache.pulsar.common.schema.SchemaType schemaType, @Nullable Class<?> messageType, @Nullable Class<?> messageKeyType)
      Get the schema to use given a schema type and schema type information.
      Type Parameters:
      T - the schema type
      Parameters:
      schemaType - schema type
      messageType - message type (not required for primitive schema types)
      messageKeyType - message key type (must be specified when schema type is KEY_VALUE)
      Returns:
      the schema to use