Table of Contents

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

applicationContext ApplicationContext
pubSubClient IMqttPubSubClient

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

schemaId string

The unique identifier of the schema to retrieve. This is required to locate the schema in the registry.

version string

The version of the schema to fetch. If not specified, defaults to "1.0.0".

timeout TimeSpan?

An optional timeout for the operation, which specifies the maximum time allowed for the request to complete.

cancellationToken CancellationToken

A token that can be used to cancel the operation before completion if needed.

Returns

Task<Schema>

PutAsync(string, Format, SchemaType, string, Dictionary<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, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

schemaContent string

The content of the schema to be added or updated in the registry.

schemaFormat Format

The format of the schema. Specifies how the schema content should be interpreted.

schemaType SchemaType

The type of the schema, such as message schema or data schema. Defaults to MessageSchema.

version string

The version of the schema to add or update. If not specified, defaults to "1.0.0".

tags Dictionary<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.

timeout TimeSpan?

An optional timeout for the operation, which specifies the maximum time allowed for the request to complete.

cancellationToken CancellationToken

A token that can be used to cancel the operation before completion if needed.

Returns

Task<Schema>