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".
Inherited Members
Namespace: Confluent.SchemaRegistry
Assembly: Confluent.SchemaRegistry.dll
Syntax
public class AssociatedNameStrategyConstructors
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
| Type | Name | Description |
|---|---|---|
| ISchemaRegistryClient | schemaRegistryClient | 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
| Type | Description |
|---|---|
| string |
KafkaClusterIdConfig
Configuration property name for the Kafka cluster ID.
Declaration
public const string KafkaClusterIdConfig = "subject.name.strategy.kafka.cluster.id"Field Value
| Type | Description |
|---|---|
| string |
NamespaceWildcard
Wildcard value for resource namespace.
Declaration
public const string NamespaceWildcard = "-"Field Value
| Type | Description |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| SerializationContext | context | The serialization context. |
| string | recordType | The type name of the data being written. |
Returns
| Type | Description |
|---|---|
| Task<string> | A task that resolves to the subject name. |