diff --git a/pom.xml b/pom.xml
index f1aca043..c582e9fd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,7 +86,7 @@
spring-cloud-alibaba-dependencies
spring-cloud-alibaba-sentinel
spring-cloud-alibaba-sentinel-datasource
- spring-cloud-alibaba-sentinel-zuul
+ spring-cloud-alibaba-sentinel-gateway
spring-cloud-alibaba-nacos-config
spring-cloud-alibaba-nacos-discovery
spring-cloud-alibaba-seata
diff --git a/spring-cloud-alibaba-dependencies/pom.xml b/spring-cloud-alibaba-dependencies/pom.xml
index ff8230c7..4ab6d0fa 100644
--- a/spring-cloud-alibaba-dependencies/pom.xml
+++ b/spring-cloud-alibaba-dependencies/pom.xml
@@ -16,7 +16,7 @@
Spring Cloud Alibaba Dependencies
- 1.5.2
+ 1.6.0
3.1.0
1.0.0
0.4.2
@@ -140,6 +140,11 @@
sentinel-zuul-adapter
${sentinel.version}
+
+ com.alibaba.csp
+ sentinel-spring-cloud-gateway-adapter
+ ${sentinel.version}
+
com.alibaba.csp
sentinel-transport-simple-http
@@ -175,13 +180,21 @@
sentinel-cluster-client-default
${sentinel.version}
+
+ com.alibaba.csp
+ sentinel-api-gateway-adapter-common
+ ${sentinel.version}
+
-
+
+
+
+
- com.alibaba.fescar
- fescar-spring
- ${fescar.version}
+ io.seata
+ seata-spring
+ ${seata.version}
@@ -230,6 +243,11 @@
spring-cloud-alibaba-sentinel-datasource
${project.version}
+
+ org.springframework.cloud
+ spring-cloud-alibaba-sentinel-gateway
+ ${project.version}
+
org.springframework.cloud
spring-cloud-alicloud-oss
diff --git a/spring-cloud-alibaba-examples/pom.xml b/spring-cloud-alibaba-examples/pom.xml
index 1bce3d15..fd47150a 100644
--- a/spring-cloud-alibaba-examples/pom.xml
+++ b/spring-cloud-alibaba-examples/pom.xml
@@ -20,6 +20,7 @@
sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example
sentinel-example/sentinel-dubbo-example/sentinel-dubbo-consumer-example
sentinel-example/sentinel-dubbo-example/sentinel-dubbo-api
+ sentinel-example/sentinel-zuul-example
nacos-example/nacos-discovery-example
nacos-example/nacos-config-example
oss-example
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/pom.xml b/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/pom.xml
new file mode 100644
index 00000000..b6ed6653
--- /dev/null
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/pom.xml
@@ -0,0 +1,83 @@
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-alibaba-examples
+ 0.1.3.BUILD-SNAPSHOT
+ ../../pom.xml
+
+ 4.0.0
+
+
+ sentinel-zuul-example
+ jar
+ Example demonstrating how to use sentinel with zuul
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-alibaba-sentinel
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-netflix-zuul
+
+
+
+ org.springframework.cloud
+ spring-cloud-alibaba-sentinel-gateway
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+ ${maven-deploy-plugin.version}
+
+ true
+
+
+
+
+
+
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/java/org/springframework/cloud/alibaba/cloud/examples/RulesController.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/java/org/springframework/cloud/alibaba/cloud/examples/RulesController.java
new file mode 100644
index 00000000..01411ab7
--- /dev/null
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/java/org/springframework/cloud/alibaba/cloud/examples/RulesController.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.alibaba.cloud.examples;
+
+import java.util.List;
+import java.util.Set;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiDefinition;
+import com.alibaba.csp.sentinel.adapter.gateway.common.api.GatewayApiDefinitionManager;
+import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayFlowRule;
+import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayRuleManager;
+import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
+import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
+
+/**
+ * @author Jim
+ */
+@RestController
+public class RulesController {
+
+ @GetMapping("/api")
+ public Set apiRules() {
+ return GatewayApiDefinitionManager.getApiDefinitions();
+ }
+
+ @GetMapping("/gateway")
+ public Set apiGateway() {
+ return GatewayRuleManager.getRules();
+ }
+
+ @GetMapping("/flow")
+ public List apiFlow() {
+ return FlowRuleManager.getRules();
+ }
+
+}
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/java/org/springframework/cloud/alibaba/cloud/examples/SentinelZuulApplication.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/java/org/springframework/cloud/alibaba/cloud/examples/SentinelZuulApplication.java
new file mode 100644
index 00000000..0942cda3
--- /dev/null
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/java/org/springframework/cloud/alibaba/cloud/examples/SentinelZuulApplication.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.alibaba.cloud.examples;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
+
+/**
+ * @author Jim
+ */
+@SpringBootApplication
+@EnableZuulProxy
+public class SentinelZuulApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(SentinelZuulApplication.class, args);
+ }
+
+}
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/java/org/springframework/cloud/alibaba/cloud/examples/ZuulConfiguration.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/java/org/springframework/cloud/alibaba/cloud/examples/ZuulConfiguration.java
new file mode 100644
index 00000000..cd01e3c7
--- /dev/null
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/java/org/springframework/cloud/alibaba/cloud/examples/ZuulConfiguration.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.alibaba.cloud.examples;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import com.alibaba.csp.sentinel.adapter.gateway.zuul.callback.RequestOriginParser;
+import com.alibaba.csp.sentinel.adapter.gateway.zuul.fallback.BlockResponse;
+import com.alibaba.csp.sentinel.adapter.gateway.zuul.fallback.ZuulBlockFallbackProvider;
+
+/**
+ * @author Jim
+ */
+@Configuration
+public class ZuulConfiguration {
+
+ @Bean
+ public ZuulBlockFallbackProvider zuulBlockFallbackProvider1() {
+ return new ZuulBlockFallbackProvider() {
+ @Override
+ public String getRoute() {
+ return "*";
+ }
+
+ @Override
+ public BlockResponse fallbackResponse(String route, Throwable cause) {
+ if (route.equals("my-service3")) {
+ return new BlockResponse(433, "Sentinel Block3", route);
+ }
+ else if (route.equals("my-service4")) {
+ return new BlockResponse(444, "my-service4", route);
+ }
+ else {
+ return new BlockResponse(499, "Sentinel Block 499", route);
+ }
+ }
+ };
+ }
+
+ @Bean
+ public RequestOriginParser requestOriginParser() {
+ return new RequestOriginParser() {
+
+ @Override
+ public String parseOrigin(HttpServletRequest request) {
+ return "123";
+ }
+ };
+ }
+
+}
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/resources/api.json b/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/resources/api.json
new file mode 100644
index 00000000..72a62c47
--- /dev/null
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/resources/api.json
@@ -0,0 +1,32 @@
+[
+ {
+ "apiName": "some_customized_api",
+ "predicateItems": [
+ {
+ "pattern": "/product/baz"
+ },
+ {
+ "pattern": "/product/foo/**",
+ "matchStrategy": 1
+ },
+ {
+ "items": [
+ {
+ "pattern": "/spring-cloud/**"
+ },
+ {
+ "pattern": "/spring-cloud-alibaba/**"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "apiName": "another_customized_api",
+ "predicateItems": [
+ {
+ "pattern": "/ahas"
+ }
+ ]
+ }
+]
\ No newline at end of file
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/resources/application.yaml b/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/resources/application.yaml
new file mode 100644
index 00000000..0e9d9abf
--- /dev/null
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/resources/application.yaml
@@ -0,0 +1,40 @@
+server:
+ port: 18086
+spring:
+ application:
+ name: sentinel-zuul
+ cloud:
+ sentinel:
+ datasource.ds2.file:
+ file: "classpath: gateway.json"
+ ruleType: gw-flow
+ datasource.ds1.file:
+ file: "classpath: api.json"
+ ruleType: gw-api-group
+ transport:
+ dashboard: localhost:8080
+ filter:
+ enabled: false
+
+management.endpoints.web.exposure.include: "*"
+
+
+zuul.routes.my-service.path: "/product/foo/**"
+zuul.routes.my-service.service-id: "my-service"
+
+zuul.routes.my-service2.path: "/my-service2/**"
+zuul.routes.my-service2.service-id: "my-service2"
+
+zuul.routes.my-service3.path: "/my-service3/**"
+zuul.routes.my-service3.service-id: "my-service3"
+
+zuul.routes.my-service4.path: "/my-service4/**"
+zuul.routes.my-service4.service-id: "my-service4"
+
+
+spring.cloud.sentinel.zuul.order.pre: 2000
+spring.cloud.sentinel.zuul.order.post: 500
+spring.cloud.sentinel.zuul.order.error: -100
+
+
+spring.cloud.sentinel.zuul.enabled: true
\ No newline at end of file
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/resources/gateway.json b/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/resources/gateway.json
new file mode 100644
index 00000000..d55265ea
--- /dev/null
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/resources/gateway.json
@@ -0,0 +1,26 @@
+[
+ {
+ "resource": "some_customized_api",
+ "count": 0
+ },
+ {
+ "resource": "my-service2",
+ "count": 0
+ },
+ {
+ "resource": "my-service3",
+ "count": 0,
+ "paramItem": {
+ "parseStrategy": 2,
+ "fieldName": "Spring-Cloud-Alibaba"
+ }
+ },
+ {
+ "resource": "my-service4",
+ "count": 0,
+ "paramItem": {
+ "parseStrategy": 3,
+ "fieldName": "name"
+ }
+ }
+]
\ No newline at end of file
diff --git a/spring-cloud-alibaba-sentinel-datasource/pom.xml b/spring-cloud-alibaba-sentinel-datasource/pom.xml
index a3c301c7..f1502add 100644
--- a/spring-cloud-alibaba-sentinel-datasource/pom.xml
+++ b/spring-cloud-alibaba-sentinel-datasource/pom.xml
@@ -27,6 +27,12 @@
true
+
+ com.alibaba.csp
+ sentinel-api-gateway-adapter-common
+ true
+
+
com.alibaba.csp
sentinel-datasource-nacos
diff --git a/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/RuleType.java b/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/RuleType.java
index e64c360c..a5004d83 100644
--- a/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/RuleType.java
+++ b/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/RuleType.java
@@ -19,6 +19,8 @@ package org.springframework.cloud.alibaba.sentinel.datasource;
import org.springframework.cloud.alibaba.sentinel.datasource.config.AbstractDataSourceProperties;
import org.springframework.util.StringUtils;
+import com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiDefinition;
+import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayFlowRule;
import com.alibaba.csp.sentinel.slots.block.AbstractRule;
import com.alibaba.csp.sentinel.slots.block.authority.AuthorityRule;
import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRule;
@@ -53,7 +55,15 @@ public enum RuleType {
/**
* authority
*/
- AUTHORITY("authority", AuthorityRule.class);
+ AUTHORITY("authority", AuthorityRule.class),
+ /**
+ * gateway flow
+ */
+ GW_FLOW("gw-flow", GatewayFlowRule.class),
+ /**
+ * api
+ */
+ GW_API_GROUP("gw-api-group", ApiDefinition.class);
/**
* alias for {@link AbstractRule}
diff --git a/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/config/AbstractDataSourceProperties.java b/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/config/AbstractDataSourceProperties.java
index 7b6f5a49..4179d28c 100644
--- a/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/config/AbstractDataSourceProperties.java
+++ b/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/config/AbstractDataSourceProperties.java
@@ -19,7 +19,10 @@ package org.springframework.cloud.alibaba.sentinel.datasource.config;
import javax.validation.constraints.NotNull;
import org.springframework.cloud.alibaba.sentinel.datasource.RuleType;
+import org.springframework.core.env.Environment;
+import com.alibaba.csp.sentinel.adapter.gateway.common.api.GatewayApiDefinitionManager;
+import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayRuleManager;
import com.alibaba.csp.sentinel.datasource.AbstractDataSource;
import com.alibaba.csp.sentinel.slots.block.authority.AuthorityRuleManager;
import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRuleManager;
@@ -43,6 +46,8 @@ public class AbstractDataSourceProperties {
private String converterClass;
@JsonIgnore
private final String factoryBeanName;
+ @JsonIgnore
+ private Environment env;
public AbstractDataSourceProperties(String factoryBeanName) {
this.factoryBeanName = factoryBeanName;
@@ -76,6 +81,14 @@ public class AbstractDataSourceProperties {
return factoryBeanName;
}
+ protected Environment getEnv() {
+ return env;
+ }
+
+ public void setEnv(Environment env) {
+ this.env = env;
+ }
+
public void preCheck(String dataSourceName) {
}
@@ -97,6 +110,12 @@ public class AbstractDataSourceProperties {
case AUTHORITY:
AuthorityRuleManager.register2Property(dataSource.getProperty());
break;
+ case GW_FLOW:
+ GatewayRuleManager.register2Property(dataSource.getProperty());
+ break;
+ case GW_API_GROUP:
+ GatewayApiDefinitionManager.register2Property(dataSource.getProperty());
+ break;
default:
break;
}
diff --git a/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/config/NacosDataSourceProperties.java b/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/config/NacosDataSourceProperties.java
index fd5eb195..be835040 100644
--- a/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/config/NacosDataSourceProperties.java
+++ b/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/config/NacosDataSourceProperties.java
@@ -48,9 +48,13 @@ public class NacosDataSourceProperties extends AbstractDataSourceProperties {
@Override
public void preCheck(String dataSourceName) {
- if (StringUtils.isEmpty(serverAddr) && acmPropertiesInvalid()) {
- throw new IllegalArgumentException(
- "NacosDataSource properties value not correct. serverAddr is empty but there is empty value in accessKey, secretKey, endpoint, namespace property");
+ if (StringUtils.isEmpty(serverAddr)) {
+ serverAddr = this.getEnv().getProperty(
+ "spring.cloud.sentinel.datasource.nacos.server-addr", "");
+ if (StringUtils.isEmpty(serverAddr)) {
+ throw new IllegalArgumentException(
+ "NacosDataSource server-addr is empty");
+ }
}
}
@@ -110,9 +114,4 @@ public class NacosDataSourceProperties extends AbstractDataSourceProperties {
this.secretKey = secretKey;
}
- public boolean acmPropertiesInvalid() {
- return StringUtils.isEmpty(endpoint) || StringUtils.isEmpty(accessKey)
- || StringUtils.isEmpty(secretKey) || StringUtils.isEmpty(namespace);
- }
-
}
diff --git a/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/config/ZookeeperDataSourceProperties.java b/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/config/ZookeeperDataSourceProperties.java
index 6138b872..6cbff41e 100644
--- a/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/config/ZookeeperDataSourceProperties.java
+++ b/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/config/ZookeeperDataSourceProperties.java
@@ -19,6 +19,7 @@ package org.springframework.cloud.alibaba.sentinel.datasource.config;
import javax.validation.constraints.NotNull;
import org.springframework.cloud.alibaba.sentinel.datasource.factorybean.ZookeeperDataSourceFactoryBean;
+import org.springframework.util.StringUtils;
/**
* Zookeeper Properties class Using by {@link DataSourcePropertiesConfiguration} and
@@ -32,7 +33,6 @@ public class ZookeeperDataSourceProperties extends AbstractDataSourceProperties
super(ZookeeperDataSourceFactoryBean.class.getName());
}
- @NotNull
private String serverAddr;
private String path;
@@ -41,6 +41,18 @@ public class ZookeeperDataSourceProperties extends AbstractDataSourceProperties
private String dataId;
+ @Override
+ public void preCheck(String dataSourceName) {
+ if (StringUtils.isEmpty(serverAddr)) {
+ serverAddr = this.getEnv()
+ .getProperty("spring.cloud.sentinel.datasource.zk.server-addr", "");
+ if (StringUtils.isEmpty(serverAddr)) {
+ throw new IllegalArgumentException(
+ "ZookeeperDataSource server-addr is empty");
+ }
+ }
+ }
+
public String getServerAddr() {
return serverAddr;
}
diff --git a/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/converter/SentinelConverter.java b/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/converter/SentinelConverter.java
index 06d2f65b..2f7ad975 100644
--- a/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/converter/SentinelConverter.java
+++ b/spring-cloud-alibaba-sentinel-datasource/src/main/java/org/springframework/cloud/alibaba/sentinel/datasource/converter/SentinelConverter.java
@@ -17,7 +17,9 @@
package org.springframework.cloud.alibaba.sentinel.datasource.converter;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import org.slf4j.Logger;
@@ -25,8 +27,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.cloud.alibaba.sentinel.datasource.RuleType;
import org.springframework.util.StringUtils;
+import com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiDefinition;
+import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayFlowRule;
import com.alibaba.csp.sentinel.datasource.Converter;
-import com.alibaba.csp.sentinel.slots.block.AbstractRule;
import com.alibaba.csp.sentinel.slots.block.authority.AuthorityRule;
import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRule;
import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRuleManager;
@@ -50,8 +53,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
* @see ParamFlowRule
* @see ObjectMapper
*/
-public abstract class SentinelConverter
- implements Converter> {
+public abstract class SentinelConverter
+ implements Converter> {
private static final Logger log = LoggerFactory.getLogger(SentinelConverter.class);
@@ -65,11 +68,20 @@ public abstract class SentinelConverter
}
@Override
- public List convert(String source) {
- List ruleList = new ArrayList<>();
+ public Collection