mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 12:12:08 +08:00
fix:param
This commit is contained in:
@@ -9,7 +9,7 @@ import com.yomahub.liteflow.core.FlowInitHook;
|
||||
import com.yomahub.liteflow.parser.el.ClassXmlFlowELParser;
|
||||
import com.yomahub.liteflow.parser.redis.exception.RedisException;
|
||||
import com.yomahub.liteflow.parser.redis.util.RedisParserByPolling;
|
||||
import com.yomahub.liteflow.parser.redis.util.RedisParserByPubSub;
|
||||
import com.yomahub.liteflow.parser.redis.util.RedisParserBySubscribe;
|
||||
import com.yomahub.liteflow.parser.redis.util.RedisParserHelper;
|
||||
import com.yomahub.liteflow.parser.redis.vo.RedisParserVO;
|
||||
import com.yomahub.liteflow.property.LiteflowConfig;
|
||||
@@ -52,9 +52,9 @@ public class RedisXmlELParser extends ClassXmlFlowELParser {
|
||||
//检查配置文件
|
||||
checkParserVO(redisParserVO);
|
||||
|
||||
//选择Pub/Sub机制 or 轮询机制
|
||||
if (StrUtil.equalsIgnoreCase("false", redisParserVO.isPolling())) {
|
||||
redisParserHelper = new RedisParserByPubSub(redisParserVO);
|
||||
//选择订阅机制 or 轮询机制
|
||||
if (StrUtil.equalsIgnoreCase("subscribe", redisParserVO.getMode())) {
|
||||
redisParserHelper = new RedisParserBySubscribe(redisParserVO);
|
||||
} else {
|
||||
//todo 实例化轮询机制
|
||||
redisParserHelper = new RedisParserByPolling(redisParserVO);
|
||||
|
||||
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.text.StrFormatter;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.yomahub.liteflow.builder.LiteFlowNodeBuilder;
|
||||
import com.yomahub.liteflow.builder.el.LiteFlowChainELBuilder;
|
||||
@@ -34,7 +33,7 @@ import java.util.Set;
|
||||
* @since 2.10.6
|
||||
*/
|
||||
|
||||
public class RedisParserByPubSub implements RedisParserHelper {
|
||||
public class RedisParserBySubscribe implements RedisParserHelper {
|
||||
|
||||
private final RedisParserVO redisParserVO;
|
||||
|
||||
@@ -42,7 +41,7 @@ public class RedisParserByPubSub implements RedisParserHelper {
|
||||
|
||||
private RedissonClient scriptClient;
|
||||
|
||||
public RedisParserByPubSub(RedisParserVO redisParserVO) {
|
||||
public RedisParserBySubscribe(RedisParserVO redisParserVO) {
|
||||
this.redisParserVO = redisParserVO;
|
||||
|
||||
try {
|
||||
@@ -53,13 +52,11 @@ public class RedisParserByPubSub implements RedisParserHelper {
|
||||
catch (Exception ignored) {
|
||||
}
|
||||
if (ObjectUtil.isNull(chainClient)) {
|
||||
Config config = getRedissonConfig(redisParserVO,
|
||||
Integer.parseInt(redisParserVO.getChainDataBase()));
|
||||
Config config = getRedissonConfig(redisParserVO, redisParserVO.getChainDataBase());
|
||||
this.chainClient = Redisson.create(config);
|
||||
//如果有脚本数据
|
||||
if (StrUtil.isNotBlank(redisParserVO.getScriptDataBase())) {
|
||||
config = getRedissonConfig(redisParserVO,
|
||||
Integer.parseInt(redisParserVO.getScriptDataBase()));
|
||||
if (Objects.isNull(redisParserVO.getScriptDataBase())) {
|
||||
config = getRedissonConfig(redisParserVO, redisParserVO.getScriptDataBase());
|
||||
this.scriptClient = Redisson.create(config);
|
||||
}
|
||||
}
|
||||
@@ -147,7 +144,7 @@ public class RedisParserByPubSub implements RedisParserHelper {
|
||||
|
||||
public boolean hasScript() {
|
||||
// 没有scriptClient或没有配置scriptDataBase
|
||||
if (Objects.isNull(scriptClient) || StrUtil.isBlank(redisParserVO.getScriptDataBase())) {
|
||||
if (Objects.isNull(scriptClient) || Objects.isNull(redisParserVO.getScriptDataBase())) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
@@ -185,7 +182,7 @@ public class RedisParserByPubSub implements RedisParserHelper {
|
||||
});
|
||||
|
||||
//监听 script
|
||||
if (Objects.nonNull(scriptClient) && StrUtil.isNotBlank(redisParserVO.getScriptDataBase())) {
|
||||
if (Objects.nonNull(scriptClient) && Objects.isNull(redisParserVO.getScriptDataBase())) {
|
||||
RMapCache<String, String> scriptKey = scriptClient.getMapCache(redisParserVO.getScriptKey());
|
||||
//添加 script
|
||||
scriptKey.addListener((EntryCreatedListener<String, String>) event -> {
|
||||
@@ -3,7 +3,6 @@ package com.yomahub.liteflow.parser.redis.util;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
@@ -18,20 +18,20 @@ public class RedisParserVO {
|
||||
/*密码*/
|
||||
private String password;
|
||||
|
||||
/*是否采用轮询机制 默认为轮询 否则选择pub/sub机制*/
|
||||
private String isPolling = "true";
|
||||
/*监听机制 轮询为poll 订阅为subscribe 默认为poll*/
|
||||
private String mode = "poll";
|
||||
|
||||
/*轮询时间间隔(ms) 默认1分钟 若选择pub/sub机制可不配置*/
|
||||
/*轮询时间间隔(ms) 默认1分钟 若选择订阅机制可不配置*/
|
||||
private String pollingInterval = "60000";
|
||||
|
||||
/*chain表配置的数据库号*/
|
||||
private String chainDataBase;
|
||||
private Integer chainDataBase;
|
||||
|
||||
/*chain配置的键名*/
|
||||
private String chainKey;
|
||||
|
||||
/*脚本表配置的数据库号 若没有脚本数据可不配置*/
|
||||
private String scriptDataBase;
|
||||
private Integer scriptDataBase;
|
||||
|
||||
/*脚本配置的键名 若没有脚本数据可不配置*/
|
||||
private String scriptKey;
|
||||
@@ -60,12 +60,12 @@ public class RedisParserVO {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String isPolling() {
|
||||
return isPolling;
|
||||
public String getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public void setPolling(String polling) {
|
||||
isPolling = polling;
|
||||
public void setMode(String mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public String getPollingInterval() {
|
||||
@@ -76,11 +76,11 @@ public class RedisParserVO {
|
||||
this.pollingInterval = pollingInterval;
|
||||
}
|
||||
|
||||
public String getChainDataBase() {
|
||||
public Integer getChainDataBase() {
|
||||
return chainDataBase;
|
||||
}
|
||||
|
||||
public void setChainDataBase(String chainDataBase) {
|
||||
public void setChainDataBase(Integer chainDataBase) {
|
||||
this.chainDataBase = chainDataBase;
|
||||
}
|
||||
|
||||
@@ -92,11 +92,11 @@ public class RedisParserVO {
|
||||
this.chainKey = chainKey;
|
||||
}
|
||||
|
||||
public String getScriptDataBase() {
|
||||
public Integer getScriptDataBase() {
|
||||
return scriptDataBase;
|
||||
}
|
||||
|
||||
public void setScriptDataBase(String scriptDataBase) {
|
||||
public void setScriptDataBase(Integer scriptDataBase) {
|
||||
this.scriptDataBase = scriptDataBase;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user