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 2019/12/14 13:47:03 UTC

[GitHub] [rocketmq-externals] lrhkobe commented on a change in pull request #488: [ISSUE #487] Jdbc source connector support syncing data with white ta…

lrhkobe commented on a change in pull request #488: [ISSUE #487] Jdbc source connector support syncing data with white ta…
URL: https://github.com/apache/rocketmq-externals/pull/488#discussion_r357918657
 
 

 ##########
 File path: rocketmq-connect-jdbc/src/main/java/org/apache/rocketmq/connect/jdbc/source/Querier.java
 ##########
 @@ -132,19 +149,36 @@ public void poll()  {
 
     public void start() throws Exception {
         String whiteDataBases = config.getWhiteDataBase();
-        String whiteTables = config.getWhiteTable();
-
-        if (!StringUtils.isEmpty(whiteDataBases)) {
-            Arrays.asList(whiteDataBases.trim().split(",")).forEach(whiteDataBase -> {
-                Collections.addAll(schema.dataBaseWhiteList, whiteDataBase);
-            });
+        JSONObject whiteDataBaseObject = JSONObject.parseObject(whiteDataBases);
+
+        if (whiteDataBaseObject != null){
+            for (String whiteDataBaseName : whiteDataBaseObject.keySet()){
+                JSONObject whiteTableObject = (JSONObject)whiteDataBaseObject.get(whiteDataBaseName);
+                HashSet<String> whiteTableSet = new HashSet<>();
+                for (String whiteTableName : whiteTableObject.keySet()){
+                    Collections.addAll(whiteTableSet, whiteTableName);
+                    HashMap<String, String> filterMap = new HashMap<>();
+                    JSONObject tableFilterObject = (JSONObject)whiteTableObject.get(whiteTableName);
+                    for(String filterKey : tableFilterObject.keySet()){
+                        filterMap.put(filterKey, tableFilterObject.getString(filterKey));
+                    }
+                    schema.tableFilterMap.put(whiteTableName, filterMap);
+                }
+                schema.dbTableMap.put(whiteDataBaseName, whiteTableSet);
+            }
         }
 
-        if (!StringUtils.isEmpty(whiteTables)) {
-            Arrays.asList(whiteTables.trim().split(",")).forEach(whiteTable -> {
-                Collections.addAll(schema.tableWhiteList, whiteTable);
-            });
-        }
+//        if (!StringUtils.isEmpty(whiteDataBases)) {
 
 Review comment:
   ok , i'll handle it.

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


With regards,
Apache Git Services