Package org.springframework.pulsar.core
Interface SchemaResolver
- All Known Implementing Classes:
DefaultSchemaResolver
public interface SchemaResolver
Resolves schema to use for message types.
- Author:
- Chris Bono
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic 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 TypeMethodDescriptiondefault <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
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 typereturnDefault
- 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
istrue
- otherwisenull
-
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 typemessageType
- 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 typemessageType
- message type (not required for primitive schema types)messageKeyType
- message key type (must be specified when schema type isKEY_VALUE
)- Returns:
- the schema to use
-