C0urante commented on code in PR #11565: URL: https://github.com/apache/kafka/pull/11565#discussion_r1142700527
########## connect/runtime/src/main/java/org/apache/kafka/connect/storage/KafkaTopicBasedBackingStore.java: ########## @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.kafka.connect.storage; + +import org.apache.kafka.clients.admin.AdminClientConfig; +import org.apache.kafka.clients.admin.NewTopic; +import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.apache.kafka.common.config.TopicConfig; +import org.apache.kafka.common.utils.Time; +import org.apache.kafka.connect.runtime.WorkerConfig; +import org.apache.kafka.connect.util.Callback; +import org.apache.kafka.connect.util.KafkaBasedLog; +import org.apache.kafka.connect.util.TopicAdmin; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; +import java.util.function.Supplier; + +public abstract class KafkaTopicBasedBackingStore { Review Comment: Ah, I forgot about the static constructors for the offset backing store. Yeah, probably not worth it to add another constructor variant for everything. I was thinking about isolating this logic into a `Supplier<KafkaBasedLog>`, and we could then have something like: ```java public class LogBuilder { public static Supplier<KafkaBasedLog<K, V>> createLog(String topic, String topicConfig, String topicPurpose...) { return () -> { KafkaBasedLog<K, V> result = ... // create and set up KafkaBasedLog, including performing topic initialization here return result; } } } public class KafkaConfigBackingStore implements ConfigBackingStore { public KafkaConfigBackingStore(Supplier<KafkaBasedLog> setupAndCreateKafkaBasedLog, ...) } ``` Which I think would still technically work here (and honestly be a bit cleaner than how we're hacking the `setupAndCreateKafkaBasedLog` method in tests right now), but given the number of new constructors it would require (which introduce their own amount of ugliness), we can stick with what's in this PR right now. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org