瀏覽代碼

nacos持久化

master
wangjx 3 年之前
父節點
當前提交
25ea11bed8
共有 2 個檔案被更改,包括 6 行新增6 行删除
  1. +3
    -3
      sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/nacos/FlowRuleNacosProvider.java
  2. +3
    -3
      sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/nacos/FlowRuleNacosPublisher.java

+ 3
- 3
sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/nacos/FlowRuleNacosProvider.java 查看文件

@@ -34,8 +34,8 @@ import java.util.List;
public class FlowRuleNacosProvider implements DynamicRuleProvider<List<FlowRuleEntity>> {

@Autowired
@Qualifier("configService")
private ConfigService configService;
@Qualifier("nacosConfiguration")
private ConfigService nacosConfiguration;
@Autowired
private NacosProperties nacosProperties;
@Autowired
@@ -44,7 +44,7 @@ public class FlowRuleNacosProvider implements DynamicRuleProvider<List<FlowRuleE
@Override
public List<FlowRuleEntity> getRules(String appName) throws Exception {
String dataId=new StringBuilder(appName).append(NacosConstants.DATA_ID_POSTFIX).toString();
String rules = configService.getConfig(dataId,nacosProperties.getGroupId(),3000);
String rules = nacosConfiguration.getConfig(dataId,nacosProperties.getGroupId(),3000);
//log.info("pull FlowRule from nacos Config:"+rules);
if (rules.isEmpty()) {
return new ArrayList<>();


+ 3
- 3
sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/nacos/FlowRuleNacosPublisher.java 查看文件

@@ -34,8 +34,8 @@ import java.util.List;
public class FlowRuleNacosPublisher implements DynamicRulePublisher<List<FlowRuleEntity>> {

@Autowired
@Qualifier("configService")
private ConfigService configService;
@Qualifier("nacosConfiguration")
private ConfigService nacosConfiguration;
@Autowired
private NacosProperties nacosProperties;
@Autowired
@@ -49,6 +49,6 @@ public class FlowRuleNacosPublisher implements DynamicRulePublisher<List<FlowRul
return;
}
String dataId=new StringBuilder(appName).append(NacosConstants.DATA_ID_POSTFIX).toString();
configService.publishConfig(dataId,nacosProperties.getGroupId(),converter.convert(rules));
nacosConfiguration.publishConfig(dataId,nacosProperties.getGroupId(),converter.convert(rules));
}
}

Loading…
取消
儲存