Class SchemaResolverProperties
- Namespace
- Solace.SchemaRegistry.Serdes.Core.Resolver
- Assembly
- Solace.SchemaRegistry.Serdes.Core.dll
Provides configuration properties for schema registry resolvers, including connection details, authentication credentials, and SSL validation settings. This class extends BaseProperties to provide typed access to schema registry-specific configuration values.
public class SchemaResolverProperties : BaseProperties
- Inheritance
-
SchemaResolverProperties
- Derived
- Inherited Members
Remarks
SchemaResolverProperties encapsulates all the configuration settings needed to connect to and authenticate with a schema registry service. It provides both typed property access and maintains the underlying configuration dictionary for flexibility.
The configuration includes registry URL, authentication credentials, SSL certificate validation settings, and other connection parameters needed for schema registry operations.
Constructors
SchemaResolverProperties(IDictionary<string, object>)
Initializes a new instance of the SchemaResolverProperties class with the specified configuration dictionary. The constructor stores a copy of the raw configuration without calling virtual methods. Call Initialize() after construction to apply defaults and load configuration.
protected SchemaResolverProperties(IDictionary<string, object> configuration)
Parameters
configurationIDictionary<string, object>A dictionary containing configuration key-value pairs. Required properties must be provided.
Exceptions
- ArgumentNullException
Thrown when configuration is null
Properties
ArtifactReferenceResolverStrategyType
Gets the artifact reference resolver strategy type from configuration.
public Type ArtifactReferenceResolverStrategyType { get; }
Property Value
Remarks
The value can be either a Type object or a string representing a fully qualified type name.
The default value is typeof(SolaceTopicIdStrategy<,>), which is special-cased
and will be automatically closed with the appropriate type arguments during instantiation.
Important: When providing any type other than the default, only the following are supported:
- Non-generic types (e.g.,
typeof(MyCustomStrategy)) - Closed constructed generic types (e.g.,
typeof(DestinationIdStrategy<string, object>))
typeof(DestinationIdStrategy<,>)) other than the default type
are not supported and will throw an ArgumentException during configuration.
CacheLatest
Gets the cache latest property specified by the CacheLatest configuration.
public bool CacheLatest { get; }
Property Value
- bool
A boolean indicating whether the cache latest property is enabled. Returns
trueif enabled,falseotherwise. Defaults totrue.
Remarks
This property controls the caching behavior of schema lookups that use 'latest' or no version.
CacheTtl
Gets the cache time-to-live (TTL) duration specified by the CacheTtlMs configuration in milliseconds.
public TimeSpan CacheTtl { get; }
Property Value
- TimeSpan
A TimeSpan representing the TTL duration for cached schema artifacts. Defaults to 30 seconds (30000 milliseconds).
Remarks
This property determines how long a schema remains valid in the cache before it needs to be fetched again from the registry on the next relevant lookup.
Special value: 0 disables caching. Schemas will be fetched from the registry on every request.
A longer TTL can improve performance by reducing registry calls, but may increase the risk of using outdated schemas. A shorter TTL ensures more up-to-date schemas but may increase load on the registry.
ExplicitArtifactArtifactId
Gets the explicitly set artifact ID for querying an artifact in the registry, or null if not set. This property is only applicable for serializers and overrides the artifact ID returned by the IArtifactReferenceResolverStrategy<T, S>.
public string ExplicitArtifactArtifactId { get; }
Property Value
- string
The explicitly set artifact ID as a string, or null if not set. This value is retrieved from the configuration using the ExplicitArtifactArtifactId key.
ExplicitArtifactGroupId
Gets the explicitly set group ID for querying an artifact in the registry, or null if not set. This property is only applicable for serializers and overrides the group ID returned by the IArtifactReferenceResolverStrategy<T, S>.
public string ExplicitArtifactGroupId { get; }
Property Value
- string
The explicitly set group ID as a string, or null if not set. This value is retrieved from the configuration using the ExplicitArtifactGroupId key.
ExplicitArtifactVersion
Gets the explicitly set version for querying an artifact in the registry, or null if not set. This property is only applicable for serializers and overrides the version returned by the IArtifactReferenceResolverStrategy<T, S>.
public string ExplicitArtifactVersion { get; }
Property Value
- string
The explicitly set artifact version as a string, or null if not set. This value is retrieved from the configuration using the ExplicitArtifactVersion key.
Remarks
When set, this property takes precedence over FindLatestArtifact. If both are configured, the explicit version will be used instead of resolving the latest version from the registry.
FindLatestArtifact
Gets a value indicating whether the serializer should find the latest schema version from the registry.
public bool FindLatestArtifact { get; }
Property Value
- bool
trueto resolve the latest schema version from the registry, ignoring the version from the artifact reference resolver strategy;falseto use the version from the strategy. Defaults tofalse. This value is retrieved from the configuration using the FindLatestArtifact key.
Remarks
When enabled, the resolver clears the version from the artifact coordinates and the registry
returns the version with the highest GlobalId, ordered by GlobalId DESC.
The GlobalId is assigned sequentially by the registry as versions are uploaded, so
"latest" refers to the most recently uploaded version — not the highest version string.
For example, if version 1.0.0 is uploaded first and then version 0.1.0 is uploaded later,
0.1.0 is considered the latest because it has a higher GlobalId.
If ExplicitArtifactVersion is also set, the explicit version takes precedence over find-latest.
NetworkTraceEnabled
Gets a value indicating whether HTTP network trace logging is enabled for debugging.
public bool NetworkTraceEnabled { get; }
Property Value
- bool
A boolean indicating whether HTTP network trace logging is enabled. Returns
trueif enabled,falseotherwise. Defaults tofalse.
Remarks
Use only for debugging purposes. When enabled and logger is at Debug level, logs HTTP request/response details.
NetworkTraceMaxLogSize
Gets the maximum body size in bytes to log for network trace logging.
public int NetworkTraceMaxLogSize { get; }
Property Value
- int
The maximum body size in bytes to log. Defaults to
10240(10KB). Set to0for no limit.
Remarks
Only applies when NetworkTraceEnabled is enabled. Use only for debugging purposes. Bodies larger than this limit will show a truncation message instead of full content.
Password
Gets the password for schema registry authentication.
public string Password { get; }
Property Value
- string
A string containing the password for authentication, or null if no password is configured. This value is retrieved from the configuration using the AuthPassword key.
Remarks
The password is used in conjunction with the Username for authentication with the schema registry service. Passwords should be handled securely and not logged or exposed in application output.
This property returns null if the password is not configured. For security reasons, consider using secure configuration storage mechanisms for password values.
RegistryUrl
Gets the URL of the schema registry service.
public string RegistryUrl { get; }
Property Value
- string
A string containing the complete URL to the schema registry service, including protocol and port. This value is retrieved from the configuration using the RegistryUrl key.
Remarks
The registry URL is a required configuration parameter that specifies the endpoint for schema registry API operations. The URL should include the protocol (http/https) and may include port numbers if different from the default.
Example: "http://localhost:8081/apis/registry/v3"
RequestAttemptBackoff
Gets the backoff duration between retry attempts for schema registry requests.
public TimeSpan RequestAttemptBackoff { get; }
Property Value
- TimeSpan
A TimeSpan representing the duration to wait between retry attempts. Defaults to 500 milliseconds.
RequestAttempts
Gets the number of retry attempts for schema registry requests.
public long RequestAttempts { get; }
Property Value
- long
A long integer representing the maximum number of attempts for schema registry requests. Defaults to 3.
Remarks
This property determines how many times a failed registry request will be retried before throwing an exception. The value must be greater than 0.
StrategyTopicProfile
Gets the ISolaceTopicProfile object used by the SolaceTopicIdStrategy to map topics to artifact references, or null if not set.
public ISolaceTopicProfile StrategyTopicProfile { get; }
Property Value
- ISolaceTopicProfile
An ISolaceTopicProfile object that defines the mapping rules between Solace topics and artifact references in the Schema Registry, or null if not configured. This value is retrieved from the configuration using the StrategyTopicProfile key.
Remarks
This property is used to configure the topic to artifact mapping for the SolaceTopicIdStrategy. When this property is null or unset, the SolaceTopicIdStrategy will have the same behaviour as the DestinationIdStrategy.
TrustStore
Gets the collection of trusted X.509 certificates used for SSL/TLS validation.
public X509Certificate2Collection TrustStore { get; }
Property Value
- X509Certificate2Collection
An X509Certificate2Collection containing the certificates to trust when validating the schema registry server's SSL certificate. This value is retrieved from the configuration using the TrustStore key.
Remarks
The trust store contains root CA certificates used to validate the server's certificate chain. Use this when connecting to servers with self-signed certificates or certificates issued by private certificate authorities.
UseCachedOnError
Gets the use cached on error property specified by the UseCachedOnError configuration.
public bool UseCachedOnError { get; }
Property Value
- bool
A boolean indicating whether to use cached schemas when registry lookup errors occur. Returns
trueif enabled,falseotherwise. Defaults tofalse.
Remarks
This property controls whether to use cached schemas when schema registry lookup errors occur.
Username
Gets the username for schema registry authentication.
public string Username { get; }
Property Value
- string
A string containing the username for authentication, or null if no username is configured. This value is retrieved from the configuration using the AuthUsername key.
Remarks
The username is used for HTTP basic authentication or other authentication schemes supported by the schema registry service. If authentication is required but no username is provided, registry operations may fail with authentication errors.
This property returns null if the username is not configured, allowing for anonymous access scenarios where the schema registry does not require authentication.
ValidateCertificate
Gets a value indicating whether SSL certificate validation should be performed for HTTPS connections.
public bool ValidateCertificate { get; }
Property Value
- bool
trueif SSL certificates should be validated;falseto skip certificate validation. Defaults totrueif not explicitly configured for security reasons. This value is retrieved from the configuration using the ValidateCertificate key.
Remarks
Certificate validation is a critical security feature that ensures the authenticity of the schema registry server. Disabling certificate validation should only be done in development or testing environments where self-signed certificates are used.
The default value is true to maintain secure connections by default. Setting this to false in production environments creates security vulnerabilities and should be avoided unless absolutely necessary.
ValidateCertificateHostName
Gets a value indicating whether SSL certificate hostname validation should be performed for HTTPS connections.
public bool ValidateCertificateHostName { get; }
Property Value
- bool
trueif the hostname in the certificate should be validated against the server hostname;falseto skip hostname validation. Defaults totrueif not explicitly configured. This value is retrieved from the configuration using the ValidateCertificateHostName key.
Remarks
Hostname validation ensures the certificate is valid for the hostname being connected to.
This has no effect if ValidateCertificate is set to false.
Disabling hostname validation may be useful for testing with self-signed certificates, but should be avoided in production environments.
Methods
CreateArtifactReferenceResolverStrategy<T, S>(Type)
Creates an artifact reference resolver strategy instance from the specified type.
public static IArtifactReferenceResolverStrategy<T, S> CreateArtifactReferenceResolverStrategy<T, S>(Type strategyType)
Parameters
strategyTypeTypeThe generic type definition of the strategy (e.g., typeof(DestinationIdStrategy<,>))
Returns
- IArtifactReferenceResolverStrategy<T, S>
A new instance of the artifact reference resolver strategy with the appropriate type parameters
Type Parameters
TThe data type that will be serialized
SThe schema type
Exceptions
- ArgumentNullException
Thrown when
strategyTypeis null- ArgumentException
Thrown when the type cannot be instantiated or does not implement the required interface
FromDictionary(IDictionary<string, object>)
Creates a new SchemaResolverProperties instance with the specified configuration.
public static SchemaResolverProperties FromDictionary(IDictionary<string, object> configuration)
Parameters
configurationIDictionary<string, object>A dictionary containing configuration key-value pairs. Required properties must be provided.
Returns
- SchemaResolverProperties
A fully initialized SchemaResolverProperties instance.
Exceptions
- ArgumentNullException
Thrown when configuration is null
- ArgumentException
Thrown when the configuration contains invalid property values, or required properties are missing
GetDefaults()
Gets the default configuration values for schema resolver properties. Override to provide format-specific defaults.
protected virtual IDictionary<string, object> GetDefaults()
Returns
- IDictionary<string, object>
A dictionary containing default configuration key-value pairs for schema registry connections
Remarks
This method provides the baseline configuration that will be used when no specific configuration is provided. Derived classes can override this method to provide format-specific or implementation-specific default values.
Initialize()
Applies default values and loads configuration into typed properties. Must be called after construction is complete.
protected void Initialize()
LoadFromConfig()
Loads configuration values from the internal configuration dictionary into properties.
Called during construction. Derived classes should override and call base.LoadFromConfig().
protected virtual void LoadFromConfig()