|
@@ -20,7 +20,6 @@ import com.alibaba.csp.sentinel.dashboard.config.NacosPropertiesConfiguration; |
|
|
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity; |
|
|
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity; |
|
|
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 lombok.extern.log4j.Log4j; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Qualifier; |
|
|
import org.springframework.beans.factory.annotation.Qualifier; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
@@ -31,7 +30,6 @@ import java.util.List; |
|
|
/** |
|
|
/** |
|
|
* @author Eric Zhao |
|
|
* @author Eric Zhao |
|
|
*/ |
|
|
*/ |
|
|
@Log4j |
|
|
|
|
|
@Service |
|
|
@Service |
|
|
public class FlowRuleNacosProvider implements DynamicRuleProvider<List<FlowRuleEntity>> { |
|
|
public class FlowRuleNacosProvider implements DynamicRuleProvider<List<FlowRuleEntity>> { |
|
|
|
|
|
|
|
@@ -47,7 +45,7 @@ public class FlowRuleNacosProvider implements DynamicRuleProvider<List<FlowRuleE |
|
|
public List<FlowRuleEntity> getRules(String appName) throws Exception { |
|
|
public List<FlowRuleEntity> getRules(String appName) throws Exception { |
|
|
String dataId=new StringBuilder(appName).append(NacosConstants.DATA_ID_POSTFIX).toString(); |
|
|
String dataId=new StringBuilder(appName).append(NacosConstants.DATA_ID_POSTFIX).toString(); |
|
|
String rules = configService.getConfig(dataId,nacosPropertiesConfiguration.getGroupId(),3000); |
|
|
String rules = configService.getConfig(dataId,nacosPropertiesConfiguration.getGroupId(),3000); |
|
|
log.info("pull FlowRule from nacos Config:"+rules); |
|
|
|
|
|
|
|
|
//log.info("pull FlowRule from nacos Config:"+rules); |
|
|
if (rules.isEmpty()) { |
|
|
if (rules.isEmpty()) { |
|
|
return new ArrayList<>(); |
|
|
return new ArrayList<>(); |
|
|
} else { |
|
|
} else { |
|
|