Table of Contents

Class SchemaRegistrySubject

Namespace
Excalibur.Dispatch.Transport.Kafka
Assembly
Excalibur.Dispatch.Transport.Kafka.dll

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

string

ValueSuffix

The suffix appended to topic names for value schemas.

public const string ValueSuffix = "-value"

Field Value

string

Methods

ExtractTopicName(string)

Extracts the topic name from a subject name.

public static string ExtractTopicName(string subject)

Parameters

subject string

The 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

topicName string

The Kafka topic name.

Returns

string

The subject name in the format {topic}-key.

Exceptions

ArgumentException

Thrown when topicName is null or whitespace.

ForValue(string)

Creates a subject name for a value schema using TopicNameStrategy.

public static string ForValue(string topicName)

Parameters

topicName string

The Kafka topic name.

Returns

string

The subject name in the format {topic}-value.

Exceptions

ArgumentException

Thrown when topicName is null or whitespace.

IsKeySubject(string)

Determines if a subject is for a key schema.

public static bool IsKeySubject(string subject)

Parameters

subject string

The subject name to check.

Returns

bool

true if the subject ends with -key; otherwise, false.

IsValueSubject(string)

Determines if a subject is for a value schema.

public static bool IsValueSubject(string subject)

Parameters

subject string

The subject name to check.

Returns

bool

true if the subject ends with -value; otherwise, false.