justinwwhuang commented on code in PR #10801:
URL: https://github.com/apache/inlong/pull/10801#discussion_r1740891986


##########
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/RedisSource.java:
##########
@@ -84,6 +182,96 @@ public boolean sourceFinish() {
 
     @Override
     public boolean sourceExist() {
-        return false;
+        return true;
+    }
+
+    private String getRedisUri() {
+        StringBuffer sb = new StringBuffer("redis://");
+        sb.append(hostName).append(":").append(port);
+        if (!StringUtils.isEmpty(dbNumber)) {
+            sb.append("/").append(dbNumber);
+        }
+        sb.append("?");
+        if (!StringUtils.isEmpty(authPassword)) {
+            sb.append("authPassword=").append(authPassword).append("&");
+        }
+        if (!StringUtils.isEmpty(authUser)) {
+            sb.append("authUser=").append(authUser).append("&");
+        }
+        if (!StringUtils.isEmpty(readTimeout)) {
+            sb.append("readTimeout=").append(readTimeout).append("&");
+        }
+        if (ssl) {
+            sb.append("ssl=").append("yes").append("&");
+        }
+        if (!StringUtils.isEmpty(snapShot)) {
+            sb.append("replOffset=").append(snapShot).append("&");
+        }
+        if (!StringUtils.isEmpty(replId)) {
+            sb.append("replId=").append(replId).append("&");
+        }
+        if (sb.charAt(sb.length() - 1) == '?' || sb.charAt(sb.length() - 1) == 
'&') {
+            sb.deleteCharAt(sb.length() - 1);
+        }
+        return sb.toString();
+    }
+
+    private void initReplicator() {
+        redisReplicator.addEventListener((replicator, event) -> {

Review Comment:
   > > > i fix it as obtaining data by Jedis through commands first, then use 
RedisReplicator to subscribe event and filtering data by command, is that 
correct ?
   > > 
   > > 
   > > 
   > > 1. We don't necessarily mean to collect all the data from the entire 
Redis cluster. Your implementation here has always wanted to collect all the 
data? From the earliest subscription to scanning all keys now.
   > > 2. The reids command is not used as a filter, it is a different 
collection method from subscription. Remember, there should be no filtering 
logic.
   > 
   > then I feel like we don't need jedis at all, we can just get the data we 
need from subscribed events in redis replicator, Debezium does this for data 
capture and synchronization of databases too
   
   No, I hope to support data retrieval without subscription, only through 
Redis commands.



-- 
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-unsubscr...@inlong.apache.org

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

Reply via email to