Class SchemaRegistryClient
- Namespace
- Azure.Iot.Operations.Services.SchemaRegistry
- Assembly
- Azure.Iot.Operations.Services.dll
public class SchemaRegistryClient : ISchemaRegistryClient, IAsyncDisposable
- Inheritance
-
SchemaRegistryClient
- Implements
- Inherited Members
Constructors
SchemaRegistryClient(ApplicationContext, IMqttPubSubClient)
public SchemaRegistryClient(ApplicationContext applicationContext, IMqttPubSubClient pubSubClient)
Parameters
applicationContextApplicationContextpubSubClientIMqttPubSubClient
Methods
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()
Returns
- ValueTask
A task that represents the asynchronous dispose operation.
GetAsync(string, string, TimeSpan?, CancellationToken)
Retrieves schema information from a schema registry service based on the provided schema ID and version.
public Task<Schema> GetAsync(string schemaId, string version = "1", TimeSpan? timeout = null, CancellationToken cancellationToken = default)
Parameters
schemaIdstringThe unique identifier of the schema to retrieve. This is required to locate the schema in the registry.
versionstringThe version of the schema to fetch. If not specified, defaults to "1". Values are expected to be whole integers.
timeoutTimeSpan?An optional timeout for the operation, which specifies the maximum time allowed for the request to complete.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before completion if needed.
Returns
Exceptions
- SchemaRegistryErrorException
If the requested schema does not exist
PutAsync(string, Format, SchemaType, string, Dictionary<string, string>?, string?, string?, TimeSpan?, CancellationToken)
Adds or updates a schema in the schema registry service with the specified content, format, type, and metadata.
public Task<Schema> PutAsync(string schemaContent, Format schemaFormat, SchemaType schemaType = SchemaType.MessageSchema, string version = "1", Dictionary<string, string>? tags = null, string? displayName = null, string? description = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)
Parameters
schemaContentstringThe content of the schema to be added or updated in the registry.
schemaFormatFormatThe format of the schema. Specifies how the schema content should be interpreted.
schemaTypeSchemaTypeThe type of the schema, such as message schema or data schema. Defaults to MessageSchema.
versionstringThe version of the schema to add or update. If not specified, defaults to "1". Values are expected to be whole integers.
tagsDictionary<string, string>Optional metadata tags to associate with the schema. These tags can be used to store additional information about the schema in key-value format.
displayNamestringThe optional display name of the schema.
descriptionstringThe optional description of the schema.
timeoutTimeSpan?An optional timeout for the operation, which specifies the maximum time allowed for the request to complete.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before completion if needed.