Package io.debezium.schema
Class AbstractRegexTopicNamingStrategy
java.lang.Object
io.debezium.schema.AbstractTopicNamingStrategy<DataCollectionId>
io.debezium.schema.AbstractRegexTopicNamingStrategy
- All Implemented Interfaces:
TopicNamingStrategy<DataCollectionId>
- Direct Known Subclasses:
DefaultRegexTopicNamingStrategy,SchemaRegexTopicNamingStrategy
@Incubating
public abstract class AbstractRegexTopicNamingStrategy
extends AbstractTopicNamingStrategy<DataCollectionId>
An abstract regex implementation of
TopicNamingStrategy.- Author:
- Harvey Yue
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.debezium.spi.topic.TopicNamingStrategy
TopicNamingStrategy.TopicSchemaAugment<S extends Object>, TopicNamingStrategy.TopicValueAugment<I extends DataCollectionId,S extends Object, R extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate Stringprivate Patternprivate Stringprivate BoundedConcurrentHashMap<String,String> private static final org.slf4j.Loggerstatic final Fieldstatic final Fieldstatic final Fieldstatic final Fieldstatic final Fieldstatic final Fieldprivate Patternprivate StringFields inherited from class io.debezium.schema.AbstractTopicNamingStrategy
DEFAULT_HEARTBEAT_TOPIC_PREFIX, DEFAULT_TRANSACTION_TOPIC, delimiter, heartbeatPrefix, multiPartitionMode, prefix, replacement, TOPIC_CACHE_SIZE, TOPIC_DELIMITER, TOPIC_HEARTBEAT_PREFIX, TOPIC_TRANSACTION, topicNames, transactionFields inherited from interface io.debezium.spi.topic.TopicNamingStrategy
MAX_NAME_LENGTH, NO_SCHEMA_OP, NO_VALUE_OP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(Properties props) protected StringdetermineNewTopic(DataCollectionId tableId, String oldTopic) Determine the new topic name.abstract StringTopicNamingStrategy.TopicSchemaAugment<org.apache.kafka.connect.data.SchemaBuilder>TopicNamingStrategy.TopicValueAugment<DataCollectionId,org.apache.kafka.connect.data.Schema, org.apache.kafka.connect.data.Struct> private static intvalidateKeyFieldReplacement(Configuration config, Field field, Field.ValidationOutput problems) If TOPIC_KEY_FIELD_REGEX has a value that is really a regex, then the TOPIC_KEY_FIELD_REPLACEMENT must be a non-empty value.private static intvalidateTopicReplacement(Configuration config, Field field, Field.ValidationOutput problems) If TOPIC_REGEX has a value that is really a regex, then the TOPIC_REPLACEMENT must be a non-empty value.Methods inherited from class io.debezium.schema.AbstractTopicNamingStrategy
getSchemaPartsTopicName, heartbeatTopic, isValidCharacter, mkString, sanitizedTopicName, schemaChangeTopic, transactionTopicMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.debezium.spi.topic.TopicNamingStrategy
recordSchemaPrefix
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
TOPIC_REGEX
-
TOPIC_REPLACEMENT
-
TOPIC_KEY_ENFORCE_UNIQUENESS
-
TOPIC_KEY_FIELD_NAME
-
TOPIC_KEY_FIELD_REGEX
-
TOPIC_KEY_FIELD_REPLACEMENT
-
topicRegex
-
topicReplacement
-
keyEnforceUniqueness
private boolean keyEnforceUniqueness -
keyFieldName
-
keyFieldRegex
-
keyFieldReplacement
-
keyRegexReplaceCache
-
-
Constructor Details
-
AbstractRegexTopicNamingStrategy
-
-
Method Details
-
validateTopicReplacement
private static int validateTopicReplacement(Configuration config, Field field, Field.ValidationOutput problems) If TOPIC_REGEX has a value that is really a regex, then the TOPIC_REPLACEMENT must be a non-empty value. -
validateKeyFieldReplacement
private static int validateKeyFieldReplacement(Configuration config, Field field, Field.ValidationOutput problems) If TOPIC_KEY_FIELD_REGEX has a value that is really a regex, then the TOPIC_KEY_FIELD_REPLACEMENT must be a non-empty value. -
configure
- Specified by:
configurein interfaceTopicNamingStrategy<DataCollectionId>- Overrides:
configurein classAbstractTopicNamingStrategy<DataCollectionId>
-
dataChangeTopic
- Specified by:
dataChangeTopicin interfaceTopicNamingStrategy<DataCollectionId>- Specified by:
dataChangeTopicin classAbstractTopicNamingStrategy<DataCollectionId>
-
getOriginTopic
-
determineNewTopic
Determine the new topic name.- Parameters:
tableId- the table idoldTopic- the name of the old topic- Returns:
- return the new topic name, if the regex applies. Otherwise, return original topic.
-
keySchemaAugment
public TopicNamingStrategy.TopicSchemaAugment<org.apache.kafka.connect.data.SchemaBuilder> keySchemaAugment() -
keyValueAugment
public TopicNamingStrategy.TopicValueAugment<DataCollectionId,org.apache.kafka.connect.data.Schema, keyValueAugment()org.apache.kafka.connect.data.Struct>
-