confluent-kafka-dotnet
Show / Hide Table of Contents

Interface ISchemaRegistryClient

An interface implemented by Confluent Schema Registry clients.

Inherited Members
IDisposable.Dispose()
Namespace: Confluent.SchemaRegistry
Assembly: Confluent.SchemaRegistry.dll
Syntax
public interface ISchemaRegistryClient : IDisposable

Properties

AuthHeaderProvider

The authentication header provider.

Declaration
IAuthenticationHeaderValueProvider AuthHeaderProvider { get; }
Property Value
Type Description
IAuthenticationHeaderValueProvider

Config

The client config.

Declaration
IEnumerable<KeyValuePair<string, string>> Config { get; }
Property Value
Type Description
IEnumerable<KeyValuePair<string, string>>

MaxCachedSchemas

The maximum capacity of the local schema cache.

Declaration
int MaxCachedSchemas { get; }
Property Value
Type Description
int

Proxy

The web proxy.

Declaration
IWebProxy Proxy { get; }
Property Value
Type Description
IWebProxy

Methods

ClearCaches()

Clears all caches.

Declaration
void ClearCaches()

ClearLatestCaches()

Clears caches of latest versions.

Declaration
void ClearLatestCaches()

ConstructKeySubjectName(string, string)

DEPRECATED. SubjectNameStrategy should now be specified via serializer configuration. Returns the schema registry key subject name given a topic name.

Declaration
[Obsolete("SubjectNameStrategy should now be specified via serializer configuration. This method will be removed in a future release.")]
string ConstructKeySubjectName(string topic, string recordType = null)
Parameters
Type Name Description
string topic

The topic name.

string recordType

The fully qualified record type. May be null if not required by the configured subject naming strategy.

Returns
Type Description
string

The key subject name given a topic name.

ConstructValueSubjectName(string, string)

DEPRECATED. SubjectNameStrategy should now be specified via serializer configuration. Returns the schema registry value subject name given a topic name.

Declaration
[Obsolete("SubjectNameStrategy should now be specified via serializer configuration. This method will be removed in a future release.")]
string ConstructValueSubjectName(string topic, string recordType = null)
Parameters
Type Name Description
string topic

The topic name.

string recordType

The fully qualified record type. May be null if not required by the configured subject naming strategy.

Returns
Type Description
string

The value subject name given a topic name.

GetAllSubjectsAsync()

Gets a list of all subjects with registered schemas.

Declaration
Task<List<string>> GetAllSubjectsAsync()
Returns
Type Description
Task<List<string>>

A list of all subjects with registered schemas.

GetCompatibilityAsync(string)

If the subject is specified returns compatibility type for the specified subject. Otherwise returns global compatibility type.

Declaration
Task<Compatibility> GetCompatibilityAsync(string subject = null)
Parameters
Type Name Description
string subject

The subject to get the compatibility for.

Returns
Type Description
Task<Compatibility>

Compatibility type.

GetLatestSchemaAsync(string)

Get the latest schema registered against the specified subject.

Declaration
Task<RegisteredSchema> GetLatestSchemaAsync(string subject)
Parameters
Type Name Description
string subject

The subject to get the latest associated schema for.

Returns
Type Description
Task<RegisteredSchema>

The latest schema registered against subject.

GetLatestWithMetadataAsync(string, IDictionary<string, string>, bool)

Get the latest schema with the given metadata registered against the specified subject.

Declaration
Task<RegisteredSchema> GetLatestWithMetadataAsync(string subject, IDictionary<string, string> metadata, bool ignoreDeletedSchemas)
Parameters
Type Name Description
string subject

The subject to get the latest associated schema for.

IDictionary<string, string> metadata

The metadata to search for.

bool ignoreDeletedSchemas

Whether to ignore deleted schemas.

Returns
Type Description
Task<RegisteredSchema>

The latest schema with the given metadata registered against subject.

GetRegisteredSchemaAsync(string, int, bool)

Gets a schema given a subject and version number.

Declaration
Task<RegisteredSchema> GetRegisteredSchemaAsync(string subject, int version, bool ignoreDeletedSchemas = true)
Parameters
Type Name Description
string subject

The subject to get the schema for.

int version

The version number of schema to get.

bool ignoreDeletedSchemas

Whether or not to ignore deleted schemas.

Returns
Type Description
Task<RegisteredSchema>

The schema identified by the specified subject and version.

GetSchemaAsync(int, string)

Gets the schema uniquely identified by id.

Declaration
Task<Schema> GetSchemaAsync(int id, string format = null)
Parameters
Type Name Description
int id

The unique id of schema to get.

string format

The format of the schema to get. Currently, the only supported value is "serialized", and this is only valid for protobuf schemas. If 'serialized', the SchemaString property of the returned value will be a base64 encoded protobuf file descriptor. If null, SchemaString will be human readable text.

Returns
Type Description
Task<Schema>

The schema identified by id.

GetSchemaAsync(string, int)

DEPRECATED. Superseded by GetRegisteredSchemaAsync(string subject, int version) Gets a schema given a subject and version number.

Declaration
[Obsolete("Superseded by GetRegisteredSchemaAsync(string subject, int version). This method will be removed in a future release.")]
Task<string> GetSchemaAsync(string subject, int version)
Parameters
Type Name Description
string subject

The subject to get the schema for.

int version

The version number of schema to get.

Returns
Type Description
Task<string>

The schema identified by the specified subject and version.

GetSchemaBySubjectAndIdAsync(string, int, string)

Gets the schema uniquely identified by subject and id.

Declaration
Task<Schema> GetSchemaBySubjectAndIdAsync(string subject, int id, string format = null)
Parameters
Type Name Description
string subject

The subject.

int id

The unique id of schema to get.

string format

The format of the schema to get. Currently, the only supported value is "serialized", and this is only valid for protobuf schemas. If 'serialized', the SchemaString property of the returned value will be a base64 encoded protobuf file descriptor. If null, SchemaString will be human readable text.

Returns
Type Description
Task<Schema>

The schema identified by id.

GetSchemaIdAsync(string, Schema, bool)

Get the unique id of the specified schema registered against the specified subject.

Declaration
Task<int> GetSchemaIdAsync(string subject, Schema schema, bool normalize = false)
Parameters
Type Name Description
string subject

The subject the schema is registered against.

Schema schema

The schema to get the id for.

bool normalize

Whether to normalize schemas.

Returns
Type Description
Task<int>

The unique id identifying the schema.

Exceptions
Type Condition
SchemaRegistryException

Thrown if the schema is not registered against the subject.

GetSchemaIdAsync(string, string, bool)

Get the unique id of the specified avro schema registered against the specified subject.

Declaration
[Obsolete("Superseded by GetSchemaIdAsync(string, Schema, bool)")]
Task<int> GetSchemaIdAsync(string subject, string avroSchema, bool normalize = false)
Parameters
Type Name Description
string subject

The subject the schema is registered against.

string avroSchema

The schema to get the id for.

bool normalize

Whether to normalize schemas.

Returns
Type Description
Task<int>

The unique id identifying the schema.

Exceptions
Type Condition
SchemaRegistryException

Thrown if the schema is not registered against the subject.

GetSubjectVersionsAsync(string)

Gets a list of versions registered under the specified subject.

Declaration
Task<List<int>> GetSubjectVersionsAsync(string subject)
Parameters
Type Name Description
string subject

The subject to get versions registered under.

Returns
Type Description
Task<List<int>>

A list of versions registered under the specified subject.

IsCompatibleAsync(string, Schema)

Check if a schema is compatible with latest version registered against a specified subject.

Declaration
Task<bool> IsCompatibleAsync(string subject, Schema schema)
Parameters
Type Name Description
string subject

The subject to check.

Schema schema

The schema to check.

Returns
Type Description
Task<bool>

true if schema is compatible with the latest version registered against a specified subject, false otherwise.

IsCompatibleAsync(string, string)

Check if an avro schema is compatible with latest version registered against a specified subject.

Declaration
[Obsolete("Superseded by IsCompatibleAsync(string, Schema)")]
Task<bool> IsCompatibleAsync(string subject, string avroSchema)
Parameters
Type Name Description
string subject

The subject to check.

string avroSchema

The schema to check.

Returns
Type Description
Task<bool>

true if avroSchema is compatible with the latest version registered against a specified subject, false otherwise.

LookupSchemaAsync(string, Schema, bool, bool)

Get the registered schema details (including version and id) given a subject name and schema, or throw an exception if the schema is not registered against the subject.

Declaration
Task<RegisteredSchema> LookupSchemaAsync(string subject, Schema schema, bool ignoreDeletedSchemas, bool normalize = false)
Parameters
Type Name Description
string subject

The subject name the schema is registered against.

Schema schema

The schema to lookup.

bool ignoreDeletedSchemas

Whether or not to ignore deleted schemas.

bool normalize

Whether to normalize schemas.

Returns
Type Description
Task<RegisteredSchema>

The schema identified by the specified subject and schema.

RegisterSchemaAsync(string, Schema, bool)

Register a schema or get the schema id if it's already registered.

Declaration
Task<int> RegisterSchemaAsync(string subject, Schema schema, bool normalize = false)
Parameters
Type Name Description
string subject

The subject to register the schema against.

Schema schema

The schema to register.

bool normalize

Whether to normalize schemas.

Returns
Type Description
Task<int>

A unique id identifying the schema.

RegisterSchemaAsync(string, string, bool)

Register an Avro schema or get the schema id if it's already registered.

Declaration
[Obsolete("Superseded by RegisterSchemaAsync(string, Schema, bool)")]
Task<int> RegisterSchemaAsync(string subject, string avroSchema, bool normalize = false)
Parameters
Type Name Description
string subject

The subject to register the schema against.

string avroSchema

The schema to register.

bool normalize

Whether to normalize schemas.

Returns
Type Description
Task<int>

A unique id identifying the schema.

UpdateCompatibilityAsync(Compatibility, string)

If the subject is specified sets compatibility type for the specified subject. Otherwise sets global compatibility type.

Declaration
Task<Compatibility> UpdateCompatibilityAsync(Compatibility compatibility, string subject = null)
Parameters
Type Name Description
Compatibility compatibility

Compatibility type.

string subject

The subject to set the compatibility for.

Returns
Type Description
Task<Compatibility>

New compatibility type.

In this article