junaiddshaukat commented on code in PR #39546: URL: https://github.com/apache/beam/pull/39546#discussion_r3689367693
########## runners/kafka-streams/src/main/java/org/apache/beam/runners/kafka/streams/KafkaStreamsTopicManager.java: ########## @@ -0,0 +1,169 @@ +/* + * 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.beam.runners.kafka.streams; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Properties; +import java.util.Set; +import java.util.concurrent.ExecutionException; +import org.apache.kafka.clients.admin.Admin; +import org.apache.kafka.clients.admin.AdminClientConfig; +import org.apache.kafka.clients.admin.NewTopic; +import org.apache.kafka.common.errors.TopicExistsException; +import org.apache.kafka.streams.Topology; +import org.apache.kafka.streams.TopologyDescription; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Creates the topics a translated pipeline needs before the Kafka Streams application starts. + * + * <p>The runner shuffles data through topics it names itself: a bootstrap topic per Impulse and per + * primitive Read, and a repartition topic per GroupByKey. Kafka Streams does create the internal + * topics it manages on its own, but these are declared with explicit names through {@code + * addSource} and {@code addSink}, so to Kafka Streams they are ordinary user topics — it will not + * create them, and refuses to start with {@code MissingSourceTopicException} if a source topic is + * absent. Relying on the broker's {@code auto.create.topics.enable} is not an option either: it is + * off on many clusters, and a topic auto-created on first fetch gets the broker's default partition + * count rather than the pipeline's. + * + * <p>Only topics carrying one of the runner's own prefixes are created. Any other topic in the + * topology belongs to the user (a source or sink they named), and creating those implicitly would + * hide a misconfiguration behind an empty topic. + */ +class KafkaStreamsTopicManager { Review Comment: Filed for later as you suggested: https://github.com/apache/beam/issues/39566, with your create/run/delete sketch. Agreed it's out of scope here. -- 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]
