Class TopicNameStrategy
java.lang.Object
io.krabka.streams.schema.TopicNameStrategy
- All Implemented Interfaces:
SubjectNameStrategy
Uses the Confluent topic naming rule.
A key schema maps to <topic>-key and a value schema to
<topic>-value. This matches Confluent's default TopicNameStrategy,
so applications sharing topics with Confluent-configured clients resolve the same
subjects.
Example
var strategy = new TopicNameStrategy();
strategy.subject("orders", Role.KEY); // "orders-key"
strategy.subject("orders", Role.VALUE); // "orders-value"
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
TopicNameStrategy
public TopicNameStrategy()Creates the strategy; it is stateless and reusable.
-
-
Method Details
-
subject
Returns<topic>-keyor<topic>-valuedepending on the role.- Specified by:
subjectin interfaceSubjectNameStrategy- Parameters:
topic- the Kafka topic namerole- whether the schema describes the record key or value- Returns:
- the topic name with a
-keyor-valuesuffix - Throws:
NullPointerException- iftopicorroleis null
-