Class RecordIdStrategy<T>
- Namespace
- Solace.SchemaRegistry.Serdes.Avro
- Assembly
- Solace.SchemaRegistry.Serdes.Avro.dll
A strategy that resolves artifact references from the schema name and namespace embedded in the Avro schema.
public class RecordIdStrategy<T> : IArtifactReferenceResolverStrategy<T, Schema>
Type Parameters
TThe type of object to be serialized
- Inheritance
-
RecordIdStrategy<T>
- Implements
-
IArtifactReferenceResolverStrategy<T, Schema>
- Inherited Members
Remarks
The artifact ID is the schema name (Avro.NamedSchema.Name) and the group ID
is the schema namespace (Avro.NamedSchema.Namespace).
When the schema has no namespace, the group ID defaults to "default".
This strategy requires LoadSchema to be true, so the schema
parser must implement ISchemaDataReader<S, T> to extract the schema
from the record before artifact resolution begins.
Only Avro record and enum schemas are supported; all other schema
types will throw a Solace.Serdes.SerializationException.
Properties
LoadSchema
Gets a value indicating whether this strategy requires schema loading during resolution.
public bool LoadSchema { get; }
Property Value
- bool
trueif the strategy needs to load or validate schemas during artifact reference resolution;falseif the strategy can resolve references without loading schema content.
Remarks
This property allows schema resolvers to optimize their behavior based on the strategy's requirements. Strategies that don't need to load schemas can provide better performance by avoiding unnecessary schema retrieval and parsing operations.
Strategies that return false typically work with pre-existing artifact references or use metadata-based resolution that doesn't require full schema content analysis. Strategies that return true may need to examine schema content for compatibility checking, registration, or versioning decisions.
Methods
ResolveArtifactReference(IRecord<T>, IParsedSchema<Schema>)
Resolves an artifact reference from the Avro schema name and namespace.
public IArtifactReference ResolveArtifactReference(IRecord<T> data, IParsedSchema<Schema> schema)
Parameters
dataIRecord<T>The data record (not used; coordinates come from the schema)
schemaIParsedSchema<Schema>The parsed schema whose Schema must be a Avro.RecordSchema or Avro.EnumSchema.
Returns
- IArtifactReference
An IArtifactReference with the schema name as the artifact ID and the schema namespace (or
"default"when absent) as the group ID.
Exceptions
- ArgumentNullException
Thrown when
schemais null.- SerializationException
Thrown when the schema is not an Avro record or enum schema.