hgeraldino commented on code in PR #20384:
URL: https://github.com/apache/kafka/pull/20384#discussion_r3363088264
##########
connect/runtime/src/main/java/org/apache/kafka/connect/storage/KafkaTopicBasedBackingStore.java:
##########
@@ -39,17 +42,35 @@ public abstract class KafkaTopicBasedBackingStore {
Consumer<TopicAdmin> topicInitializer(String topic, NewTopic
topicDescription, WorkerConfig config, Time time) {
return admin -> {
- log.debug("Creating Connect internal topic for {}",
getTopicPurpose());
- // Create the topic if it doesn't exist
- Set<String> newTopics = createTopics(topicDescription, admin,
config, time);
- if (!newTopics.contains(topic)) {
- // It already existed, so check that the topic cleanup policy
is compact only and not delete
- log.debug("Using admin client to check cleanup policy of '{}'
topic is '{}'", topic, TopicConfig.CLEANUP_POLICY_COMPACT);
- admin.verifyTopicCleanupPolicyOnlyCompact(topic,
getTopicConfig(), getTopicPurpose());
+ if (config.internalTopicsCreationEnabled()) {
+ log.debug("Creating Connect internal topic for {}",
getTopicPurpose());
+ // Create the topic if it doesn't exist
+ Set<String> newTopics = createTopics(topicDescription, admin,
config, time);
+ if (!newTopics.contains(topic)) {
+ verifyTopicConfig(topic, admin);
+ }
+ } else {
+ log.debug("Skipping creation of Connect internal topic for {}
because automatic topic creation is disabled", getTopicPurpose());
+ Map<String, TopicDescription> existing =
admin.describeTopics(topic);
+ if (existing.isEmpty()) {
+ String msg = String.format("Topic '%s' specified via the
'%s' property is missing." +
+ " The config '%s' is set to '%s', so
automatic creation of internal topics is disabled." +
+ " Either enable automatic creation or
create the topics manually before starting the worker.",
+ topic, getTopicConfig(),
DistributedConfig.INTERNAL_TOPICS_CREATION_ENABLE_CONFIG,
config.internalTopicsCreationEnabled());
Review Comment:
```suggestion
String msg = String.format("Topic '%s' specified via the
'%s' property is missing." +
" The config '%s' is set to 'false', so
automatic creation of internal topics is disabled." +
" Either enable automatic creation or
create the topics manually before starting the worker.",
topic, getTopicConfig(),
DistributedConfig.INTERNAL_TOPICS_CREATION_ENABLE_CONFIG);
```
internalTopicsCreationEnabled() is always false in this branch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]