You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/08/01 10:33:12 UTC

[GitHub] [incubator-seatunnel] TyrantLucifer opened a new pull request, #2322: [Improve][Connector-V2] Http connector v2 source improve

TyrantLucifer opened a new pull request, #2322:
URL: https://github.com/apache/incubator-seatunnel/pull/2322

   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
   
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   -->
   
   ## Purpose of this pull request
   
   1. Unified http parameter for http sink and source
   2. Change http plugin config option constant class name from `Config` to `HttpConfig` to avoid conflict with typesafe config
   3. Change http plugin source name from `Http` to `HttpSource`
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   ## Check list
   
   * [x] Code changed are covered with tests, or it does not need tests for reason:
   * [ ] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [x] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] EricJoy2048 commented on a diff in pull request #2322: [Improve][Connector-V2] Http connector v2 source improve

Posted by GitBox <gi...@apache.org>.
EricJoy2048 commented on code in PR #2322:
URL: https://github.com/apache/incubator-seatunnel/pull/2322#discussion_r935233872


##########
seatunnel-connectors-v2/connector-http/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/config/HttpParameter.java:
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.http.config;
+
+import org.apache.seatunnel.shade.com.typesafe.config.Config;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Data
+public class HttpParameter implements Serializable {
+    private String url;
+    private String method;
+    private Map<String, String> headers;
+    private Map<String, String> params;
+    private String body;
+    public void buildWithConfig(Config pluginConfig) {
+        // set url
+        this.setUrl(pluginConfig.getString(HttpConfig.URL));

Review Comment:
   > ![image](https://user-images.githubusercontent.com/51053924/182314454-7ea91fc8-bf67-492a-a4d0-962b2e66c78a.png)
   > 
   > Because in prepare stage it is alreay check the url is or not existed, so the scenario that you said will not happen. This method can only be executed after a check.
   
   That's ok, Thank you .



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] Hisoka-X merged pull request #2322: [Improve][Connector-V2] Http connector v2 source improve

Posted by GitBox <gi...@apache.org>.
Hisoka-X merged PR #2322:
URL: https://github.com/apache/incubator-seatunnel/pull/2322


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] CalvinKirs commented on a diff in pull request #2322: [Improve][Connector-V2] Http connector v2 source improve

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on code in PR #2322:
URL: https://github.com/apache/incubator-seatunnel/pull/2322#discussion_r935070260


##########
seatunnel-connectors-v2/connector-http/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/source/HttpSource.java:
##########
@@ -39,23 +32,22 @@
 import org.apache.seatunnel.connectors.seatunnel.common.source.AbstractSingleSplitReader;
 import org.apache.seatunnel.connectors.seatunnel.common.source.AbstractSingleSplitSource;
 import org.apache.seatunnel.connectors.seatunnel.common.source.SingleSplitReaderContext;
+import org.apache.seatunnel.connectors.seatunnel.http.config.HttpConfig;
+import org.apache.seatunnel.connectors.seatunnel.http.config.HttpParameter;
 
 import org.apache.seatunnel.shade.com.typesafe.config.Config;
 
 import com.google.auto.service.AutoService;
 
-import java.util.Map;
-import java.util.stream.Collectors;
-
 @AutoService(SeaTunnelSource.class)
 public class HttpSource extends AbstractSingleSplitSource<SeaTunnelRow> {
-    private final HttpSourceParameter parameter = new HttpSourceParameter();
+    private final HttpParameter httpParameter = new HttpParameter();
     private SeaTunnelRowType rowType;
     private SeaTunnelContext seaTunnelContext;
 
     @Override
     public String getPluginName() {
-        return "Http";
+        return "HttpSource";

Review Comment:
   I think to keep `HTTP` it's better, We don't need too much redundant context



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] TyrantLucifer commented on a diff in pull request #2322: [Improve][Connector-V2] Http connector v2 source improve

Posted by GitBox <gi...@apache.org>.
TyrantLucifer commented on code in PR #2322:
URL: https://github.com/apache/incubator-seatunnel/pull/2322#discussion_r935197628


##########
seatunnel-connectors-v2/connector-http/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/config/HttpParameter.java:
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.http.config;
+
+import org.apache.seatunnel.shade.com.typesafe.config.Config;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Data
+public class HttpParameter implements Serializable {
+    private String url;
+    private String method;
+    private Map<String, String> headers;
+    private Map<String, String> params;
+    private String body;
+    public void buildWithConfig(Config pluginConfig) {
+        // set url
+        this.setUrl(pluginConfig.getString(HttpConfig.URL));

Review Comment:
   ![image](https://user-images.githubusercontent.com/51053924/182314454-7ea91fc8-bf67-492a-a4d0-962b2e66c78a.png)
   
   Because in prepare stage it is alreay check the url is or not existed, so the scenario that you said will not happen. This method can only be executed after a check.



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] TyrantLucifer commented on a diff in pull request #2322: [Improve][Connector-V2] Http connector v2 source improve

Posted by GitBox <gi...@apache.org>.
TyrantLucifer commented on code in PR #2322:
URL: https://github.com/apache/incubator-seatunnel/pull/2322#discussion_r935076266


##########
seatunnel-connectors-v2/connector-http/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/source/HttpSource.java:
##########
@@ -39,23 +32,22 @@
 import org.apache.seatunnel.connectors.seatunnel.common.source.AbstractSingleSplitReader;
 import org.apache.seatunnel.connectors.seatunnel.common.source.AbstractSingleSplitSource;
 import org.apache.seatunnel.connectors.seatunnel.common.source.SingleSplitReaderContext;
+import org.apache.seatunnel.connectors.seatunnel.http.config.HttpConfig;
+import org.apache.seatunnel.connectors.seatunnel.http.config.HttpParameter;
 
 import org.apache.seatunnel.shade.com.typesafe.config.Config;
 
 import com.google.auto.service.AutoService;
 
-import java.util.Map;
-import java.util.stream.Collectors;
-
 @AutoService(SeaTunnelSource.class)
 public class HttpSource extends AbstractSingleSplitSource<SeaTunnelRow> {
-    private final HttpSourceParameter parameter = new HttpSourceParameter();
+    private final HttpParameter httpParameter = new HttpParameter();
     private SeaTunnelRowType rowType;
     private SeaTunnelContext seaTunnelContext;
 
     @Override
     public String getPluginName() {
-        return "Http";
+        return "HttpSource";

Review Comment:
   But I think naming it this way would create some conflict with http sink, so if we keep it the same as before what's your advice about http sink name?



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] EricJoy2048 commented on a diff in pull request #2322: [Improve][Connector-V2] Http connector v2 source improve

Posted by GitBox <gi...@apache.org>.
EricJoy2048 commented on code in PR #2322:
URL: https://github.com/apache/incubator-seatunnel/pull/2322#discussion_r935183854


##########
seatunnel-connectors-v2/connector-http/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/config/HttpParameter.java:
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.http.config;
+
+import org.apache.seatunnel.shade.com.typesafe.config.Config;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Data
+public class HttpParameter implements Serializable {
+    private String url;
+    private String method;
+    private Map<String, String> headers;
+    private Map<String, String> params;
+    private String body;
+    public void buildWithConfig(Config pluginConfig) {
+        // set url
+        this.setUrl(pluginConfig.getString(HttpConfig.URL));

Review Comment:
   Please use `pluginConfig.hasPath(HttpConfig.URL)` to judge whether `HttpConfig.URL` in pluginConfig. `pluginConfig.getString(HttpConfig.URL)` will throw `NullPointException` when `HttpConfig.URL` not in pluginConfig.



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org