|
@@ -20,6 +20,7 @@ import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity; |
|
|
import com.alibaba.csp.sentinel.dashboard.rule.DynamicRuleProvider; |
|
|
import com.alibaba.csp.sentinel.dashboard.rule.DynamicRuleProvider; |
|
|
import com.alibaba.csp.sentinel.datasource.Converter; |
|
|
import com.alibaba.csp.sentinel.datasource.Converter; |
|
|
import com.alibaba.nacos.api.config.ConfigService; |
|
|
import com.alibaba.nacos.api.config.ConfigService; |
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
@@ -51,7 +52,7 @@ public class FlowRuleNacosProvider implements DynamicRuleProvider<List<FlowRuleE |
|
|
String dataId=new StringBuilder(appName).append(NacosConstants.DATA_ID_POSTFIX).toString(); |
|
|
String dataId=new StringBuilder(appName).append(NacosConstants.DATA_ID_POSTFIX).toString(); |
|
|
String rules = nacosConfiguration.getConfig(dataId,nacosProperties.getGroupId(),3000); |
|
|
String rules = nacosConfiguration.getConfig(dataId,nacosProperties.getGroupId(),3000); |
|
|
//log.info("pull FlowRule from nacos Config:"+rules); |
|
|
//log.info("pull FlowRule from nacos Config:"+rules); |
|
|
if (rules.isEmpty()) { |
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(rules)) { |
|
|
return new ArrayList<>(); |
|
|
return new ArrayList<>(); |
|
|
} else { |
|
|
} else { |
|
|
return converter.convert(rules); |
|
|
return converter.convert(rules); |
|
|