Package io.debezium.schema
Class TopicSelector<I extends DataCollectionId>
- java.lang.Object
-
- io.debezium.schema.TopicSelector<I>
-
- Type Parameters:
I- The type ofDataCollectionIdused by a given implementation
public class TopicSelector<I extends DataCollectionId> extends Object
Implementations return names for Kafka topics (data and meta-data).- Author:
- Randal Hauch, Gunnar Morling
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceTopicSelector.DataCollectionTopicNamer<I extends DataCollectionId>Implementations determine the topic name corresponding to a given data collection.private static classTopicSelector.TopicNameCache<I extends DataCollectionId>A topic namer that caches names it has obtained from a delegate.private static classTopicSelector.TopicNameSanitizer<I extends DataCollectionId>A topic namer that replaces any characters invalid in a topic name with_.
-
Field Summary
Fields Modifier and Type Field Description private TopicSelector.DataCollectionTopicNamer<I>dataCollectionTopicNamerprivate Stringdelimiterprivate StringheartbeatPrefixprivate Stringprefix
-
Constructor Summary
Constructors Modifier Constructor Description privateTopicSelector(String prefix, String heartbeatPrefix, String delimiter, TopicSelector.DataCollectionTopicNamer<I> dataCollectionTopicNamer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <I extends DataCollectionId>
TopicSelector<I>defaultSelector(CommonConnectorConfig connectorConfig, TopicSelector.DataCollectionTopicNamer<I> dataCollectionTopicNamer)static <I extends DataCollectionId>
TopicSelector<I>defaultSelector(String prefix, String heartbeatPrefix, String delimiter, TopicSelector.DataCollectionTopicNamer<I> dataCollectionTopicNamer)StringgetHeartbeatTopic()Get the name of the heartbeat topic for the given server.StringgetPrimaryTopic()Get the name of the primary topic.StringtopicNameFor(I id)Returns the name of the Kafka topic for a given data collection identifier
-
-
-
Field Detail
-
prefix
private final String prefix
-
heartbeatPrefix
private final String heartbeatPrefix
-
delimiter
private final String delimiter
-
dataCollectionTopicNamer
private final TopicSelector.DataCollectionTopicNamer<I extends DataCollectionId> dataCollectionTopicNamer
-
-
Constructor Detail
-
TopicSelector
private TopicSelector(String prefix, String heartbeatPrefix, String delimiter, TopicSelector.DataCollectionTopicNamer<I> dataCollectionTopicNamer)
-
-
Method Detail
-
defaultSelector
public static <I extends DataCollectionId> TopicSelector<I> defaultSelector(String prefix, String heartbeatPrefix, String delimiter, TopicSelector.DataCollectionTopicNamer<I> dataCollectionTopicNamer)
-
defaultSelector
public static <I extends DataCollectionId> TopicSelector<I> defaultSelector(CommonConnectorConfig connectorConfig, TopicSelector.DataCollectionTopicNamer<I> dataCollectionTopicNamer)
-
topicNameFor
public String topicNameFor(I id)
Returns the name of the Kafka topic for a given data collection identifier- Parameters:
id- the data collection identifier, nevernull- Returns:
- the name of the Kafka topic, never
null
-
getPrimaryTopic
public String getPrimaryTopic()
Get the name of the primary topic.- Returns:
- the topic name; never null
-
getHeartbeatTopic
public String getHeartbeatTopic()
Get the name of the heartbeat topic for the given server. This method returns "<prefix>-heartbeat".- Returns:
- the topic name; never null
-
-