فهرست منبع

fix: redis集群获取版本异常的bug

xsx 2 ماه پیش
والد
کامیت
13b3d11e5e
1فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 6 1
      im-common/src/main/java/com/bx/imcommon/mq/RedisMQTemplate.java

+ 6 - 1
im-common/src/main/java/com/bx/imcommon/mq/RedisMQTemplate.java

@@ -20,7 +20,12 @@ public class RedisMQTemplate extends RedisTemplate<String, Object> {
         if (version.isEmpty()) {
             RedisConnection connection = RedisConnectionUtils.getConnection(getConnectionFactory());
             Properties properties = connection.info();
-            version = properties.getProperty("redis_version");
+            for (String key : properties.stringPropertyNames()) {
+                if (key.contains("redis_version")) {
+                    version = properties.getProperty(key);
+                    break;
+                }
+            }
             RedisConnectionUtils.releaseConnection(connection,getConnectionFactory());
         }
         return version;