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()
Asynchronously dispose this object, but not the underlying mqtt client.
public ValueTask DisposeAsync()
Returns
DisposeAsync(bool)
Asynchronously dispose of this client and optionally dispose the underlying MQTT client
public ValueTask DisposeAsync(bool disposing)
Parameters
disposingboolIf true, this client will also dispose the underlying MQTT client.
Returns
DisposeAsync(bool, CancellationToken)
Asynchronously dispose of this client and optionally dispose the underlying MQTT client
public ValueTask DisposeAsync(bool disposing, CancellationToken cancellationToken)
Parameters
disposingboolIf true, this client will also dispose the underlying MQTT client.
cancellationTokenCancellationTokenCancellation token
Returns
DisposeAsync(CancellationToken)
Asynchronously dispose this object, but not the underlying mqtt client.
public ValueTask DisposeAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancellation token
Returns
DisposeAsyncCore(bool, CancellationToken)
protected virtual ValueTask DisposeAsyncCore(bool disposing, CancellationToken cancellationToken)
Parameters
disposingboolcancellationTokenCancellationToken
Returns
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 SchemaType.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.
Returns
StopAsync(CancellationToken)
Make this client unsubscribe from any topics that it subscribed to.
public Task StopAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken