capistrant commented on code in PR #18460:
URL: https://github.com/apache/druid/pull/18460#discussion_r2316393077


##########
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisorSpecBuilder.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.druid.indexing.kafka.supervisor;
+
+import org.apache.druid.segment.indexing.DataSchema;
+
+import java.util.function.Consumer;
+
+/**
+ * Builder for a {@link KafkaSupervisorSpec}, which can be sent over a POST 
call
+ * to the Overlord.
+ */
+public class KafkaSupervisorSpecBuilder
+{
+  private String id;
+  private final DataSchema.Builder dataSchema = new DataSchema.Builder();
+  private final KafkaIOConfigBuilder ioConfig = new KafkaIOConfigBuilder();
+  private final KafkaTuningConfigBuilder tuningConfig = new 
KafkaTuningConfigBuilder();
+
+  public KafkaSupervisorSpecBuilder 
withDataSchema(Consumer<DataSchema.Builder> updateDataSchema)
+  {
+    updateDataSchema.accept(this.dataSchema);
+    return this;
+  }
+
+  public KafkaSupervisorSpecBuilder 
withTuningConfig(Consumer<KafkaTuningConfigBuilder> updateTuningConfig)
+  {
+    updateTuningConfig.accept(this.tuningConfig);
+    return this;
+  }
+
+  public KafkaSupervisorSpecBuilder 
withIoConfig(Consumer<KafkaIOConfigBuilder> updateIOConfig)
+  {
+    updateIOConfig.accept(this.ioConfig);
+    return this;
+  }
+
+  public KafkaSupervisorSpecBuilder withId(String id)
+  {
+    this.id = id;
+    return this;
+  }
+
+  /**
+   * Builds a new {@link KafkaSupervisorSpec} with the specified parameters.
+   */
+  public KafkaSupervisorSpec build(String dataSource, String topic)

Review Comment:
   Am I understanding correctly that if you want to use `topicPattern` in the 
IOConfig, it must have been explicitly set in the underlying IOConfig for this 
builder? And when doing taht, you then pass null at the call-site?
   
   This feels a bit confusing and requiring insider knowledge. I think at 
minimum, we should have a `@param` field for topic in the javadoc calling out 
the case when you want to use topicPattern. But we should also consider the 
idea of removing `topic` from this method and requiring caller to have handled 
setting topic/topicPattern in ioConfig. Was it created this way because it made 
it the most easy to migrate since a vast majority were using topic and only few 
things use topicPattern?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to