raminqaf commented on a change in pull request #114:
URL: https://github.com/apache/bahir-flink/pull/114#discussion_r593939633



##########
File path: 
flink-connector-influxdb2/src/main/java/org/apache/flink/streaming/connectors/influxdb/sink/InfluxDBSinkBuilder.java
##########
@@ -0,0 +1,101 @@
+/*
+ * 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.flink.streaming.connectors.influxdb.sink;
+
+import static 
org.apache.flink.streaming.connectors.influxdb.sink.InfluxDBSinkOptions.INFLUXDB_BUCKET;
+import static 
org.apache.flink.streaming.connectors.influxdb.sink.InfluxDBSinkOptions.INFLUXDB_ORGANIZATION;
+import static 
org.apache.flink.streaming.connectors.influxdb.sink.InfluxDBSinkOptions.INFLUXDB_PASSWORD;
+import static 
org.apache.flink.streaming.connectors.influxdb.sink.InfluxDBSinkOptions.INFLUXDB_URL;
+import static 
org.apache.flink.streaming.connectors.influxdb.sink.InfluxDBSinkOptions.INFLUXDB_USERNAME;
+import static 
org.apache.flink.streaming.connectors.influxdb.sink.InfluxDBSinkOptions.WRITE_BUFFER_SIZE;
+import static 
org.apache.flink.streaming.connectors.influxdb.sink.InfluxDBSinkOptions.WRITE_DATA_POINT_CHECKPOINT;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
+import java.util.Properties;
+import 
org.apache.flink.streaming.connectors.influxdb.sink.writer.InfluxDBSchemaSerializer;
+
+public final class InfluxDBSinkBuilder<IN> {
+    private InfluxDBSchemaSerializer<IN> influxDBSchemaSerializer;
+    private final Properties properties;
+
+    public InfluxDBSinkBuilder() {
+        this.influxDBSchemaSerializer = null;
+        this.properties = new Properties();
+    }
+
+    public InfluxDBSinkBuilder<IN> setInfluxDBUrl(final String influxDBUrl) {
+        return this.setProperty(INFLUXDB_URL.key(), influxDBUrl);

Review comment:
       I took rather a different approach here. I created all the mandatory 
fields as properties and assigned them with `null` in the constructor. Whenever 
the `build()` is called I check all the fields for not being null. WDYT?
   
   ```java
       private void sanityCheck() {
           // Check required settings.
           checkNotNull(this.influxDBUrl, "The InfluxDB URL is required but not 
provided.");
           checkNotNull(this.influxDBUsername, "The InfluxDB username is 
required but not provided.");
           checkNotNull(this.influxDBPassword, "The InfluxDB password is 
required but not provided.");
           checkNotNull(this.bucketName, "The Bucket name is required but not 
provided.");
           checkNotNull(this.organizationName, "The Organization name is 
required but not provided.");
           checkNotNull( this.influxDBSchemaSerializer, "Serialization schema 
is required but not provided.");
       }
   ```




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to