2011shenlin commented on a change in pull request #3:
URL: https://github.com/apache/rocketmq-connect/pull/3#discussion_r833893002



##########
File path: 
connectors/aliyun/rocketmq-connect-http/src/main/java/org/apache/rocketmq/connect/http/sink/HttpSinkConnector.java
##########
@@ -0,0 +1,67 @@
+package org.apache.rocketmq.connect.http.sink;
+
+import org.apache.rocketmq.connect.http.sink.constant.HttpConstant;
+import io.openmessaging.KeyValue;
+import io.openmessaging.connector.api.component.task.Task;
+import io.openmessaging.connector.api.component.task.sink.SinkConnector;
+import io.openmessaging.internal.DefaultKeyValue;
+import org.apache.commons.lang3.StringUtils;
+
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.List;
+
+public class HttpSinkConnector extends SinkConnector {
+
+    private String url;
+
+    @Override
+    public void pause() {
+
+    }
+
+    @Override
+    public void resume() {
+
+    }
+
+    @Override
+    public List<KeyValue> taskConfigs(int maxTasks) {
+        List<KeyValue> keyValueList = new ArrayList<>(11);
+        KeyValue keyValue = new DefaultKeyValue();
+        keyValue.put(HttpConstant.URL_CONSTANT, url);
+        keyValueList.add(keyValue);
+        return keyValueList;
+    }
+
+    @Override
+    public Class<? extends Task> taskClass() {
+        return HttpSinkTask.class;
+    }
+
+    @Override
+    public void validate(KeyValue config) {
+        if (StringUtils.isBlank(config.getString(HttpConstant.URL_CONSTANT))) {
+            throw new RuntimeException("http required parameter is null !");
+        }
+        try {
+            URL urlConnect = new URL(url);
+            URLConnection urlConnection = urlConnect.openConnection();

Review comment:
       validate is after the init(), so the url is null




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


Reply via email to