Class SchemaRegistrySubject
Provides helpers for constructing schema registry subject names.
public static class SchemaRegistrySubject
- Inheritance
-
SchemaRegistrySubject
- Inherited Members
Remarks
This class implements the TopicNameStrategy (default) for subject naming. Future implementations may support RecordNameStrategy and TopicRecordNameStrategy.
Subject format: {topic}-key or {topic}-value
Fields
KeySuffix
The suffix appended to topic names for key schemas.
public const string KeySuffix = "-key"
Field Value
ValueSuffix
The suffix appended to topic names for value schemas.
public const string ValueSuffix = "-value"
Field Value
Methods
ExtractTopicName(string)
Extracts the topic name from a subject name.
public static string ExtractTopicName(string subject)
Parameters
subjectstringThe subject name.
Returns
- string
The topic name, or the original subject if it doesn't match the expected format.
ForKey(string)
Creates a subject name for a key schema using TopicNameStrategy.
public static string ForKey(string topicName)
Parameters
topicNamestringThe Kafka topic name.
Returns
- string
The subject name in the format
{topic}-key.
Exceptions
- ArgumentException
Thrown when
topicNameis null or whitespace.
ForValue(string)
Creates a subject name for a value schema using TopicNameStrategy.
public static string ForValue(string topicName)
Parameters
topicNamestringThe Kafka topic name.
Returns
- string
The subject name in the format
{topic}-value.
Exceptions
- ArgumentException
Thrown when
topicNameis null or whitespace.
IsKeySubject(string)
Determines if a subject is for a key schema.
public static bool IsKeySubject(string subject)
Parameters
subjectstringThe subject name to check.
Returns
IsValueSubject(string)
Determines if a subject is for a value schema.
public static bool IsValueSubject(string subject)
Parameters
subjectstringThe subject name to check.