1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

sync & commit in finchley

This commit is contained in:
fangjian0423
2019-10-30 13:10:10 +08:00
parent 6be45914c8
commit 15465b5612
436 changed files with 7099 additions and 3202 deletions

View File

@@ -1,11 +1,11 @@
package com.alibaba.cloud.examples;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import com.alibaba.cloud.sentinel.rest.SentinelClientHttpResponse;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
/**
* @author fangjian
*/

View File

@@ -1,13 +1,13 @@
package com.alibaba.cloud.examples;
import com.alibaba.cloud.sentinel.annotation.SentinelRestTemplate;
import com.alibaba.csp.sentinel.datasource.Converter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
import com.alibaba.cloud.sentinel.annotation.SentinelRestTemplate;
import com.alibaba.csp.sentinel.datasource.Converter;
/**
* @author xiaojing
*/

View File

@@ -1,13 +1,13 @@
package com.alibaba.cloud.examples;
import com.alibaba.csp.sentinel.annotation.SentinelResource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import com.alibaba.csp.sentinel.annotation.SentinelResource;
/**
* @author xiaojing
*/

View File

@@ -6,9 +6,9 @@
[Sentinel](https://github.com/alibaba/Sentinel) 是阿里巴巴开源的分布式系统的流量防卫组件Sentinel 把流量作为切入点,从流量控制,熔断降级,系统负载保护等多个维度保护服务的稳定性。
[Dubbo](http://dubbo.apache.org/)是一款高性能Java RPC框架有对应的[SpringBoot工程](https://github.com/apache/incubator-dubbo-spring-boot-project)。
[Dubbo](http://dubbo.apache.org/)是一款高性能Java RPC框架有对应的[SpringBoot工程](https://github.com/apache/dubbo-spring-boot-project)。
本项目专注于Sentinel与Dubbo的整合关于Sentinel的更多特性可以查看[sentinel-core-example](https://github.com/spring-cloud-incubator/spring-cloud-alibaba/tree/master/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example)。
本项目专注于Sentinel与Dubbo的整合关于Sentinel的更多特性可以查看[sentinel-core-example](https://github.com/alibaba/spring-cloud-alibaba/tree/master/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example)。
## 示例
@@ -66,7 +66,7 @@ Provider端在application.properties文件中定义dubbo相关的配置比如
`sentinel-dubbo-api`模块中定义了FooService服务内容如下
package FooService;
package com.alibaba.cloud.examples;
public interface FooService {
String hello(String name);
}
@@ -93,7 +93,7 @@ Consumer端在服务调用之前先定义限流规则。
`sentinel-dubbo-api`模块中定义了FooService服务内容如下
package FooService;
package com.alibaba.cloud.examples;
public interface FooService {
String hello(String name);
}

View File

@@ -7,7 +7,7 @@ This example illustrates how to use Sentinel starter to implement flow control f
[Dubbo](http://dubbo.apache.org/) is a high-performance, java based open source RPC framework.
This example focus on the integration of Sentinel and Dubbo. You can see more features on [sentinel-core-example](https://github.com/spring-cloud-incubator/spring-cloud-alibaba/tree/master/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example).
This example focus on the integration of Sentinel and Dubbo. You can see more features on [sentinel-core-example](https://github.com/alibaba/spring-cloud-alibaba/tree/master/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example).
## Demo
@@ -64,7 +64,7 @@ Define some configs of dubbo in `application.properties` in provider side, like
`sentinel-dubbo-api` define a service named FooService:
package FooService;
package com.alibaba.cloud.examples;
public interface FooService {
String hello(String name);
}
@@ -91,7 +91,7 @@ We will configure flow control rules before service invocation in consumer side.
`sentinel-dubbo-api` define a service named FooService:
package FooService;
package com.alibaba.cloud.examples;
public interface FooService {
String hello(String name);
}

View File

@@ -25,6 +25,7 @@
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>sentinel-dubbo-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>

View File

@@ -2,17 +2,17 @@ package com.alibaba.cloud.examples;
import java.util.Collections;
import com.alibaba.csp.sentinel.slots.block.RuleConstant;
import com.alibaba.csp.sentinel.slots.block.SentinelRpcException;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import com.alibaba.csp.sentinel.slots.block.RuleConstant;
import com.alibaba.csp.sentinel.slots.block.SentinelRpcException;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
/**
* @author fangjian
*/

View File

@@ -25,6 +25,7 @@
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>sentinel-dubbo-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>

View File

@@ -16,7 +16,9 @@
package com.alibaba.cloud.examples;
import static org.springframework.web.reactive.function.BodyInserters.fromObject;
import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.BlockRequestHandler;
import reactor.core.publisher.Mono;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -24,9 +26,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.ServerResponse;
import org.springframework.web.server.ServerWebExchange;
import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.BlockRequestHandler;
import reactor.core.publisher.Mono;
import static org.springframework.web.reactive.function.BodyInserters.fromObject;
/**
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>

View File

@@ -19,9 +19,6 @@ package com.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;
@@ -31,6 +28,9 @@ import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
import reactor.core.publisher.Mono;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
*/

View File

@@ -16,7 +16,9 @@
package com.alibaba.cloud.examples;
import static org.springframework.web.reactive.function.BodyInserters.fromObject;
import com.alibaba.csp.sentinel.adapter.spring.webflux.callback.BlockRequestHandler;
import reactor.core.publisher.Mono;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -25,9 +27,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.ServerResponse;
import org.springframework.web.server.ServerWebExchange;
import com.alibaba.csp.sentinel.adapter.spring.webflux.callback.BlockRequestHandler;
import reactor.core.publisher.Mono;
import static org.springframework.web.reactive.function.BodyInserters.fromObject;
/**
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>

View File

@@ -16,15 +16,15 @@
package com.alibaba.cloud.examples;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.csp.sentinel.adapter.reactor.SentinelReactorTransformer;
import com.alibaba.csp.sentinel.annotation.SentinelResource;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
*/

View File

@@ -19,9 +19,6 @@ package com.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;
@@ -29,6 +26,9 @@ 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;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
*/

View File

@@ -18,13 +18,13 @@ package com.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;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
*/