bug #I8AF1O 修复redis的订阅模式mode解析的bug
This commit is contained in:
parent
60859f4a90
commit
84a9edbc58
|
@ -40,13 +40,17 @@ public class RedisXmlELParser extends ClassXmlFlowELParser {
|
|||
|
||||
try {
|
||||
RedisParserVO redisParserVO = null;
|
||||
String configJson;
|
||||
if (MapUtil.isNotEmpty((liteflowConfig.getRuleSourceExtDataMap()))) {
|
||||
redisParserVO = BeanUtil.toBean(liteflowConfig.getRuleSourceExtDataMap(),
|
||||
RedisParserVO.class, CopyOptions.create());
|
||||
}
|
||||
else if (StrUtil.isNotBlank(liteflowConfig.getRuleSourceExtData())) {
|
||||
redisParserVO = JsonUtil.parseObject(liteflowConfig.getRuleSourceExtData(), RedisParserVO.class);
|
||||
configJson = JsonUtil.toJsonString(liteflowConfig.getRuleSourceExtDataMap());
|
||||
}else if (StrUtil.isNotBlank(liteflowConfig.getRuleSourceExtData())) {
|
||||
configJson = liteflowConfig.getRuleSourceExtData();
|
||||
}else{
|
||||
throw new RedisException(ERROR_COMMON_MSG);
|
||||
}
|
||||
|
||||
redisParserVO = JsonUtil.parseObject(configJson, RedisParserVO.class);
|
||||
|
||||
if (Objects.isNull(redisParserVO)) {
|
||||
throw new RedisException(ERROR_COMMON_MSG);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class RClient {
|
|||
* @return hashmap
|
||||
*/
|
||||
public Map<String, String> getMap(String key) {
|
||||
RMapCache<String, String> mapCache = redissonClient.getMapCache(key);
|
||||
RMapCache<String, String> mapCache = redissonClient.getMapCache(key, StringCodec.INSTANCE);
|
||||
Set<String> mapFieldSet = mapCache.keySet();
|
||||
if (CollectionUtil.isEmpty(mapFieldSet)) {
|
||||
return map;
|
||||
|
@ -69,7 +69,7 @@ public class RClient {
|
|||
* @return keySet
|
||||
*/
|
||||
public Set<String> hkeys(String key) {
|
||||
RMap<String, String> map = redissonClient.getMap(key, new StringCodec());
|
||||
RMap<String, String> map = redissonClient.getMap(key, StringCodec.INSTANCE);
|
||||
return map.readAllKeySet();
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class RClient {
|
|||
* @return hash value
|
||||
*/
|
||||
public String hget(String key, String field) {
|
||||
RMap<String, String> map = redissonClient.getMap(key, new StringCodec());
|
||||
RMap<String, String> map = redissonClient.getMap(key, StringCodec.INSTANCE);
|
||||
return map.get(field);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class RClient {
|
|||
* @return shaDigest
|
||||
*/
|
||||
public String scriptLoad(String luaScript) {
|
||||
RScript script = redissonClient.getScript(new StringCodec());
|
||||
RScript script = redissonClient.getScript(StringCodec.INSTANCE);
|
||||
return script.scriptLoad(luaScript);
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class RClient {
|
|||
* @return string
|
||||
*/
|
||||
public String evalSha(String shaDigest, String... args){
|
||||
RScript script = redissonClient.getScript(new StringCodec());
|
||||
RScript script = redissonClient.getScript(StringCodec.INSTANCE);
|
||||
return script.evalSha(RScript.Mode.READ_ONLY, shaDigest, RScript.ReturnType.VALUE,
|
||||
Arrays.asList(args)).toString();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
|||
import org.redisson.Redisson;
|
||||
import org.redisson.api.RMapCache;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.redisson.client.codec.StringCodec;
|
||||
import org.redisson.config.Config;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
@ -60,8 +61,8 @@ public class RedisWithXmlELSubscribeSpringbootTest extends BaseTest {
|
|||
Config config = new Config();
|
||||
config.useSingleServer().setAddress("redis://127.0.0.1:6379").setDatabase(1);
|
||||
redissonClient = Redisson.create(config);
|
||||
RMapCache<String, String> chainKey = redissonClient.getMapCache("testChainKey");
|
||||
RMapCache<String, String> scriptKey = redissonClient.getMapCache("testScriptKey");
|
||||
RMapCache<String, String> chainKey = redissonClient.getMapCache("testChainKey", StringCodec.INSTANCE);
|
||||
RMapCache<String, String> scriptKey = redissonClient.getMapCache("testScriptKey", StringCodec.INSTANCE);
|
||||
scriptKey.put("s1:script:脚本s1:groovy", "defaultContext.setData(\"test1\",\"hello s1\");");
|
||||
scriptKey.put("s2:script:脚本s2:js", "defaultContext.setData(\"test2\",\"hello s2\");");
|
||||
scriptKey.put("s3:script:脚本s3", "defaultContext.setData(\"test3\",\"hello s3\");");
|
||||
|
@ -183,8 +184,8 @@ public class RedisWithXmlELSubscribeSpringbootTest extends BaseTest {
|
|||
//redis内规则数据数据清空
|
||||
public static void testCleanData() {
|
||||
if (ObjectUtil.isNotNull(redissonClient)) {
|
||||
RMapCache<String, String> chainKey = redissonClient.getMapCache("testChainKey");
|
||||
RMapCache<String, String> scriptKey = redissonClient.getMapCache("testScriptKey");
|
||||
RMapCache<String, String> chainKey = redissonClient.getMapCache("testChainKey", StringCodec.INSTANCE);
|
||||
RMapCache<String, String> scriptKey = redissonClient.getMapCache("testScriptKey", StringCodec.INSTANCE);
|
||||
for (String key : chainKey.keySet()) {
|
||||
chainKey.remove(key);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue