Interface IArtifactReferenceResolverStrategy<T, S>
- Assembly
- Solace.SchemaRegistry.Serdes.Core.dll
Defines a strategy for resolving artifact references during schema resolution operations. This interface provides different approaches for determining the appropriate artifact reference based on data records and schema information, supporting various serialization scenarios.
public interface IArtifactReferenceResolverStrategy<T, S>
Type Parameters
TThe type of data contained in records processed by this strategy
SThe type of schema objects used by this strategy
Remarks
IArtifactReferenceResolverStrategy implements the Strategy pattern to provide different approaches for artifact reference resolution during serialization operations. Different strategies can implement varying behaviors such as schema registration, caching, versioning, and compatibility checking.
The strategy is used by schema resolvers to determine the appropriate artifact reference when serializing data that doesn't already have an explicit schema identifier. This enables flexible schema management policies and supports different serialization scenarios.
Properties
LoadSchema
Gets a value indicating whether this strategy requires schema loading during resolution.
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<S>)
Resolves an artifact reference for the specified data record and schema.
IArtifactReference ResolveArtifactReference(IRecord<T> data, IParsedSchema<S> schema)
Parameters
dataIRecord<T>The data record containing the value and metadata to be serialized
schemaIParsedSchema<S>The parsed schema that will be used for serialization
Returns
- IArtifactReference
An IArtifactReference that identifies the schema artifact to be used for serialization, including version and identifier information.
Remarks
This method determines the appropriate artifact reference based on the provided data and schema. The resolution strategy may involve checking existing registrations, creating new schema versions, or applying versioning policies based on the implementation's behavior.
The returned artifact reference will be used by serializers to embed schema identification information in the serialized output, enabling proper deserialization with the correct schema version.
Exceptions
- ArgumentNullException
Thrown when
dataorschemais null- SerializationException
Thrown when the artifact reference cannot be resolved or schema registration fails