confluent-kafka-dotnet
Show / Hide Table of Contents

Class AssociatedNameStrategy

Associated subject name strategy implementation that uses a schema registry client and configuration to determine subject names.

This strategy queries schema registry for the associated subject name for the topic. The topic is passed as the resource name to schema registry. If there is a configuration property named "subject.name.strategy.kafka.cluster.id", then its value will be passed as the resource namespace; otherwise the value "-" will be passed as the resource namespace.

If more than one subject is returned from the query, an exception will be thrown. If no subjects are returned from the query, then the behavior will fall back to Topic strategy, unless the configuration property "subject.name.strategy.fallback.type" is set to "RECORD", "TOPIC_RECORD", or "NONE".

Inheritance
object
AssociatedNameStrategy
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Confluent.SchemaRegistry
Assembly: Confluent.SchemaRegistry.dll
Syntax
public class AssociatedNameStrategy

Constructors

AssociatedNameStrategy(ISchemaRegistryClient, IEnumerable<KeyValuePair<string, string>>)

Initializes a new instance of the AssociatedNameStrategy class.

Declaration
public AssociatedNameStrategy(ISchemaRegistryClient schemaRegistryClient, IEnumerable<KeyValuePair<string, string>> config)
Parameters
TypeNameDescription
ISchemaRegistryClientschemaRegistryClient

The schema registry client to use for lookups.

IEnumerable<KeyValuePair<string, string>>config

The configuration.

Fields

FallbackTypeConfig

Configuration property name for the subject name strategy fallback type.

Declaration
public const string FallbackTypeConfig = "subject.name.strategy.fallback.type"
Field Value
TypeDescription
string

KafkaClusterIdConfig

Configuration property name for the Kafka cluster ID.

Declaration
public const string KafkaClusterIdConfig = "subject.name.strategy.kafka.cluster.id"
Field Value
TypeDescription
string

NamespaceWildcard

Wildcard value for resource namespace.

Declaration
public const string NamespaceWildcard = "-"
Field Value
TypeDescription
string

Methods

GetSubjectNameAsync(SerializationContext, string)

Asynchronously gets the subject name for the given serialization context and record type.

Declaration
public Task<string> GetSubjectNameAsync(SerializationContext context, string recordType)
Parameters
TypeNameDescription
SerializationContextcontext

The serialization context.

stringrecordType

The type name of the data being written.

Returns
TypeDescription
Task<string>

A task that resolves to the subject name.

In this article