leesf commented on a change in pull request #1842:
URL: https://github.com/apache/hudi/pull/1842#discussion_r457309449



##########
File path: 
hudi-client/src/main/java/org/apache/hudi/config/HoodieWriteCommitCallbackConfig.java
##########
@@ -0,0 +1,108 @@
+/*
+ * 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.hudi.config;
+
+import org.apache.hudi.callback.common.HoodieCommitCallbackType;
+import org.apache.hudi.common.config.DefaultHoodieConfig;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Write callback related config.
+ */
+public class HoodieWriteCommitCallbackConfig extends DefaultHoodieConfig {
+
+  public static final String CALLBACK_ON = "hoodie.write.commit.callback.on";
+  public static final boolean DEFAULT_CALLBACK_ON = false;
+
+  public static final String CALLBACK_TYPE_PROP = 
"hoodie.write.commit.callback.type";
+  public static final String DEFAULT_CALLBACK_TYPE_PROP = 
HoodieCommitCallbackType.HTTP.name();
+
+  public static final String CALLBACK_CLASS_PROP = 
"hoodie.write.commit.callback.class";
+  public static final String DEFAULT_CALLBACK_CLASS_PROP = "";
+
+  // ***** REST callback configs *****
+  public static final String CALLBACK_HTTP_URL_PROP = 
"hoodie.write.commit.callback.http.url";
+  public static final String CALLBACK_API_KEY = 
"hoodie.write.commit.callback.http.api.key";
+  public static final String DEFAULT_CALLBACK_API_KEY = 
"hudi_write_commit_callback";
+  public static final String CALLBACK_TIMEOUT_SECONDS = 
"hoodie.write.commit.callback.rest.timeout.seconds";
+  public static final String DEFAULT_CALLBACK_TIMEOUT_SECONDS = "3";
+
+  private HoodieWriteCommitCallbackConfig(Properties props) {
+    super(props);
+  }
+
+  public static HoodieWriteCommitCallbackConfig.Builder newBuilder() {
+    return new HoodieWriteCommitCallbackConfig.Builder();
+  }
+
+  public static class Builder {
+
+    private final Properties props = new Properties();
+
+    public HoodieWriteCommitCallbackConfig.Builder fromFile(File 
propertiesFile) throws IOException {
+      try (FileReader reader = new FileReader(propertiesFile)) {
+        this.props.load(reader);
+        return this;
+      }
+    }
+
+    public HoodieWriteCommitCallbackConfig.Builder fromProperties(Properties 
props) {
+      this.props.putAll(props);
+      return this;
+    }
+
+    public HoodieWriteCommitCallbackConfig.Builder 
writeCommitCallbackOn(String callbackOn) {
+      props.setProperty(CALLBACK_ON, String.valueOf(callbackOn));

Review comment:
       no need use `String.valueOf` 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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to