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/10/30 07:22:29 UTC

[GitHub] [incubator-seatunnel] TaoZex commented on a diff in pull request #3188: [Improve][Connector-V2][Redis] Support redis cluster connection & user authentication

TaoZex commented on code in PR #3188:
URL: https://github.com/apache/incubator-seatunnel/pull/3188#discussion_r1008803526


##########
docs/en/connector-v2/sink/Redis.md:
##########
@@ -75,10 +77,18 @@ Redis data types, support `key` `hash` `list` `set` `zset`
 - zset
 > Each data from upstream will be added to the configured zset key with a weight of 1. So the order of data in zset is based on the order of data consumption.
 
+### user [String]
+
+redis authentication user, you need it when you connect to an encrypted cluster
+
 ### auth [String]
 
 Redis authentication password, you need it when you connect to an encrypted cluster
 
+### mode [String]
+
+redis mode, `single` or `cluster`, default is `single`
+
 ### format [String]

Review Comment:
   same as above



##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/JedisWrapper.java:
##########
@@ -0,0 +1,88 @@
+/*
+ * 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.redis.config;
+
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisCluster;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class JedisWrapper extends Jedis {
+    private final JedisCluster jedisCluster;
+
+    public JedisWrapper(JedisCluster jedisCluster) {
+        this.jedisCluster = jedisCluster;
+    }
+
+    @Override
+    public String set(final String key, final String value) {
+        return jedisCluster.set(key, value);
+    }
+
+    @Override
+    public String get(final String key) {
+        return jedisCluster.get(key);
+    }
+
+    @Override
+    public long hset(final String key, final Map<String, String> hash) {
+        return jedisCluster.hset(key, hash);
+    }
+
+    @Override
+    public Map<String, String> hgetAll(final String key) {
+        return jedisCluster.hgetAll(key);
+    }
+
+    @Override
+    public long lpush(final String key, final String... strings) {
+        return jedisCluster.lpush(key, strings);
+    }
+
+    @Override
+    public List<String> lrange(final String key, final long start, final long stop) {
+        return jedisCluster.lrange(key, start, stop);
+    }
+
+    @Override
+    public long sadd(final String key, final String... members) {
+        return jedisCluster.sadd(key, members);
+    }
+
+    @Override
+    public Set<String> smembers(final String key) {
+        return jedisCluster.smembers(key);
+    }
+
+    @Override
+    public long zadd(final String key, final double score, final String member) {
+        return jedisCluster.zadd(key, score, member);
+    }
+
+    @Override
+    public List<String> zrange(final String key, final long start, final long stop) {
+        return jedisCluster.zrange(key, start, stop);
+    }
+
+    @Override
+    public void close() {
+        jedisCluster.close();
+    }

Review Comment:
   Do we need to check jedisCluster 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: commits-unsubscribe@seatunnel.apache.org

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