You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/05/27 09:44:34 UTC

[GitHub] [rocketmq-connect] odbozhou opened a new pull request, #151: [ISSUE #150] sink support topic tag

odbozhou opened a new pull request, #151:
URL: https://github.com/apache/rocketmq-connect/pull/151

   ## What is the purpose of the change
   
   XXXXX
   
   ## Brief changelog
   
   XX
   
   ## Verifying this change
   
   XXXX
   
   Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
   
   - [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq-connect/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue. 
   - [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/rocketmq/tree/master/test).
   - [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install -DskipITs` to make sure unit-test pass. Run `mvn clean test-compile failsafe:integration-test`  to make sure integration-test pass.
   - [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
   


-- 
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: dev-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq-connect] odbozhou commented on a diff in pull request #151: [ISSUE #150] sink support topic tag

Posted by GitBox <gi...@apache.org>.
odbozhou commented on code in PR #151:
URL: https://github.com/apache/rocketmq-connect/pull/151#discussion_r904475562


##########
rocketmq-connect-runtime/src/main/java/org/apache/rocketmq/connect/runtime/config/SinkConnectorConfig.java:
##########
@@ -19,25 +19,30 @@
 package org.apache.rocketmq.connect.runtime.config;
 
 import com.google.common.base.Splitter;
-import java.util.HashSet;
+import java.util.HashMap;
 import java.util.List;
-import java.util.Set;
+import java.util.Map;
 import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.rocketmq.common.message.MessageQueue;
 import org.apache.rocketmq.connect.runtime.common.ConnectKeyValue;
 
 public class SinkConnectorConfig extends ConnectConfig {
 
 
 
-    public static Set<String> parseTopicList(ConnectKeyValue taskConfig) {
-        String messageQueueStr = taskConfig.getString(RuntimeConfigDefine.CONNECT_TOPICNAME);
-        if (StringUtils.isBlank(messageQueueStr)) {
-            return null;
+    public static Map<String, String> parseTopicList(ConnectKeyValue taskConfig) {
+        String topicNameAndTagss = taskConfig.getString(RuntimeConfigDefine.CONNECT_TOPICNAME);
+        List<String> topicTagList = Splitter.on(COMMA).omitEmptyStrings().trimResults().splitToList(topicNameAndTagss);
+        Map<String, String> topicNameAndTagssMap = new HashMap<>(8);
+        for (String topicTagPair : topicTagList) {
+            List<String> topicAndTag = Splitter.on(SEMICOLON).omitEmptyStrings().trimResults().splitToList(topicTagPair);

Review Comment:
   When there is no tag, if you configure multiple topics, it should be topic1, topic2, topic3. If there is a tag, it should be topic1;tag1, topic2;tag2, topic3;tag3, if so, is there no compatibility problem?



-- 
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: dev-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq-connect] lizhiboo commented on a diff in pull request #151: [ISSUE #150] sink support topic tag

Posted by GitBox <gi...@apache.org>.
lizhiboo commented on code in PR #151:
URL: https://github.com/apache/rocketmq-connect/pull/151#discussion_r899796813


##########
rocketmq-connect-runtime/src/main/java/org/apache/rocketmq/connect/runtime/config/SinkConnectorConfig.java:
##########
@@ -19,25 +19,30 @@
 package org.apache.rocketmq.connect.runtime.config;
 
 import com.google.common.base.Splitter;
-import java.util.HashSet;
+import java.util.HashMap;
 import java.util.List;
-import java.util.Set;
+import java.util.Map;
 import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.rocketmq.common.message.MessageQueue;
 import org.apache.rocketmq.connect.runtime.common.ConnectKeyValue;
 
 public class SinkConnectorConfig extends ConnectConfig {
 
 
 
-    public static Set<String> parseTopicList(ConnectKeyValue taskConfig) {
-        String messageQueueStr = taskConfig.getString(RuntimeConfigDefine.CONNECT_TOPICNAME);
-        if (StringUtils.isBlank(messageQueueStr)) {
-            return null;
+    public static Map<String, String> parseTopicList(ConnectKeyValue taskConfig) {
+        String topicNameAndTagss = taskConfig.getString(RuntimeConfigDefine.CONNECT_TOPICNAME);
+        List<String> topicTagList = Splitter.on(COMMA).omitEmptyStrings().trimResults().splitToList(topicNameAndTagss);
+        Map<String, String> topicNameAndTagssMap = new HashMap<>(8);
+        for (String topicTagPair : topicTagList) {
+            List<String> topicAndTag = Splitter.on(SEMICOLON).omitEmptyStrings().trimResults().splitToList(topicTagPair);

Review Comment:
   IMO, exchange COMMA and SEMICOLON to maintain upgrade compatible.



-- 
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: dev-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq-connect] ShannonDing commented on pull request #151: [ISSUE #150] sink support topic tag

Posted by GitBox <gi...@apache.org>.
ShannonDing commented on PR #151:
URL: https://github.com/apache/rocketmq-connect/pull/151#issuecomment-1214947042

   files conflicted. @odbozhou 


-- 
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: dev-unsubscribe@rocketmq.apache.org

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