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
TypeDescription
IAuthenticationHeaderValueProvider

Config

The client config.

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

MaxCachedSchemas

The maximum capacity of the local schema cache.

Declaration
int MaxCachedSchemas { get; }
Property Value
TypeDescription
int

Proxy

The web proxy.

Declaration
IWebProxy Proxy { get; }
Property Value
TypeDescription
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
TypeNameDescription
stringtopic

The topic name.

stringrecordType

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

Returns
TypeDescription
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
TypeNameDescription
stringtopic

The topic name.

stringrecordType

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

Returns
TypeDescription
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
TypeDescription
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
TypeNameDescription
stringsubject

The subject to get the compatibility for.

Returns
TypeDescription
Task<Compatibility>

Compatibility type.

GetLatestSchemaAsync(string)

Get the latest schema registered against the specified subject.

Declaration
Task<RegisteredSchema> GetLatestSchemaAsync(string subject)
Parameters
TypeNameDescription
stringsubject

The subject to get the latest associated schema for.

Returns
TypeDescription
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
TypeNameDescription
stringsubject

The subject to get the latest associated schema for.

IDictionary<string, string>metadata

The metadata to search for.

boolignoreDeletedSchemas

Whether to ignore deleted schemas.

Returns
TypeDescription
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
TypeNameDescription
stringsubject

The subject to get the schema for.

intversion

The version number of schema to get.

boolignoreDeletedSchemas

Whether or not to ignore deleted schemas.

Returns
TypeDescription
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
TypeNameDescription
intid

The unique id of schema to get.

stringformat

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
TypeDescription
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
TypeNameDescription
stringsubject

The subject to get the schema for.

intversion

The version number of schema to get.

Returns
TypeDescription
Task<string>

The schema identified by the specified subject and version.

GetSchemaByGuidAsync(string, string)

Gets the schema uniquely identified by guid.

Declaration
Task<Schema> GetSchemaByGuidAsync(string guid, string format = null)
Parameters
TypeNameDescription
stringguid

The globally unique id of schema to get.

stringformat

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
TypeDescription
Task<Schema>

The schema identified by guid.

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
TypeNameDescription
stringsubject

The subject.

intid

The unique id of schema to get.

stringformat

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
TypeDescription
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
TypeNameDescription
stringsubject

The subject the schema is registered against.

Schemaschema

The schema to get the id for.

boolnormalize

Whether to normalize schemas.

Returns
TypeDescription
Task<int>

The unique id identifying the schema.

Exceptions
TypeCondition
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
TypeNameDescription
stringsubject

The subject the schema is registered against.

stringavroSchema

The schema to get the id for.

boolnormalize

Whether to normalize schemas.

Returns
TypeDescription
Task<int>

The unique id identifying the schema.

Exceptions
TypeCondition
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
TypeNameDescription
stringsubject

The subject to get versions registered under.

Returns
TypeDescription
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
TypeNameDescription
stringsubject

The subject to check.

Schemaschema

The schema to check.

Returns
TypeDescription
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
TypeNameDescription
stringsubject

The subject to check.

stringavroSchema

The schema to check.

Returns
TypeDescription
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
TypeNameDescription
stringsubject

The subject name the schema is registered against.

Schemaschema

The schema to lookup.

boolignoreDeletedSchemas

Whether or not to ignore deleted schemas.

boolnormalize

Whether to normalize schemas.

Returns
TypeDescription
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
TypeNameDescription
stringsubject

The subject to register the schema against.

Schemaschema

The schema to register.

boolnormalize

Whether to normalize schemas.

Returns
TypeDescription
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
TypeNameDescription
stringsubject

The subject to register the schema against.

stringavroSchema

The schema to register.

boolnormalize

Whether to normalize schemas.

Returns
TypeDescription
Task<int>

A unique id identifying the schema.

RegisterSchemaWithResponseAsync(string, Schema, bool)

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

Declaration
Task<RegisteredSchema> RegisterSchemaWithResponseAsync(string subject, Schema schema, bool normalize = false)
Parameters
TypeNameDescription
stringsubject

The subject to register the schema against.

Schemaschema

The schema to register.

boolnormalize

Whether to normalize schemas.

Returns
TypeDescription
Task<RegisteredSchema>

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
TypeNameDescription
Compatibilitycompatibility

Compatibility type.

stringsubject

The subject to set the compatibility for.

Returns
TypeDescription
Task<Compatibility>

New compatibility type.

In this article