mynameborat commented on a change in pull request #1226: SAMZA-2406: Add 
ConfigLoader interface and default PropertiesConfigLo…
URL: https://github.com/apache/samza/pull/1226#discussion_r353518150
 
 

 ##########
 File path: samza-api/src/main/java/org/apache/samza/config/ConfigLoader.java
 ##########
 @@ -0,0 +1,35 @@
+/*
+ * 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.samza.config;
+
+import java.util.Map;
+
+
+/**
+ * Build a {@link org.apache.samza.config.Config}
+ */
+public interface ConfigLoader {
+  /**
+   * Build a specific Config.
+   * @param properties Map containing necessary information for this loader to 
get config.
+   * @return Newly constructed Config.
+   */
+  Config getConfig(Map<String, String> properties);
 
 Review comment:
   It will better to have APIs that have strong and well-defined contracts. 
Taking in a Map<String, String> seems very fragile and makes it harder for the 
implementors. 
   
   Additionally, what do you think about passing this information during 
construction as opposed to method parameter since these are fundamental 
properties for the config loaders to work in the first place. With that, we can 
fail fast during construction and it is also easy to reason about the failures 
in getConfig as operational failures instead of validation checks.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to