mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
update greenwich docs
This commit is contained in:
parent
980bc3fd7a
commit
6c6fe021e1
@ -44,7 +44,7 @@ image::https://img.alicdn.com/tfs/TB1dyWJbQL0gK0jSZFtXXXQCXXa-2788-1086.png[]
|
|||||||
* pom.xml的配置。一个完整的 pom.xml 配置如下所示:
|
* pom.xml的配置。一个完整的 pom.xml 配置如下所示:
|
||||||
|
|
||||||
.pom.xml
|
.pom.xml
|
||||||
[source,xml,indent=0]
|
[source,xml]
|
||||||
----
|
----
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
@ -166,7 +166,7 @@ NOTE: 在使用 RocketMQ Binder 的同时也可以配置 rocketmq.** 用于触
|
|||||||
MessageBuilder builder = MessageBuilder.withPayload(msg)
|
MessageBuilder builder = MessageBuilder.withPayload(msg)
|
||||||
.setHeader(RocketMQHeaders.TAGS, "binder")
|
.setHeader(RocketMQHeaders.TAGS, "binder")
|
||||||
.setHeader(RocketMQHeaders.KEYS, "my-key")
|
.setHeader(RocketMQHeaders.KEYS, "my-key")
|
||||||
.setHeader("DELAY", "1");
|
.setHeader(MessageConst.PROPERTY_DELAY_TIME_LEVEL, "1");
|
||||||
Message message = builder.build();
|
Message message = builder.build();
|
||||||
output().send(message);
|
output().send(message);
|
||||||
```
|
```
|
||||||
|
@ -16,6 +16,7 @@ https://github.com/alibaba/Sentinel[Sentinel] 具有以下特征:
|
|||||||
如果要在您的项目中引入 Sentinel,使用 group ID 为 `com.alibaba.cloud` 和 artifact ID 为 `spring-cloud-starter-alibaba-sentinel` 的 starter。
|
如果要在您的项目中引入 Sentinel,使用 group ID 为 `com.alibaba.cloud` 和 artifact ID 为 `spring-cloud-starter-alibaba-sentinel` 的 starter。
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
|
[source,yaml]
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
@ -109,7 +110,6 @@ java -Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject
|
|||||||
==== 配置控制台信息
|
==== 配置控制台信息
|
||||||
|
|
||||||
.application.yml
|
.application.yml
|
||||||
[source,yaml]
|
|
||||||
----
|
----
|
||||||
spring:
|
spring:
|
||||||
cloud:
|
cloud:
|
||||||
|
@ -32,3 +32,5 @@ include::schedulerx.adoc[]
|
|||||||
include::sms.adoc[]
|
include::sms.adoc[]
|
||||||
|
|
||||||
include::sidecar.adoc[]
|
include::sidecar.adoc[]
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,73 @@
|
|||||||
|
=== Circuit Breaker: Spring Cloud Circuit Breaker With Sentinel & Configuring Sentinel Circuit Breakers
|
||||||
|
|
||||||
|
==== Default Configuration
|
||||||
|
|
||||||
|
To provide a default configuration for all of your circuit breakers create a `Customizer` bean that is passed a
|
||||||
|
`SentinelCircuitBreakerFactory` or `ReactiveSentinelCircuitBreakerFactory`.
|
||||||
|
The `configureDefault` method can be used to provide a default configuration.
|
||||||
|
|
||||||
|
====
|
||||||
|
[source,java]
|
||||||
|
----
|
||||||
|
@Bean
|
||||||
|
public Customizer<SentinelCircuitBreakerFactory> defaultCustomizer() {
|
||||||
|
return factory -> factory.configureDefault(id -> new SentinelConfigBuilder(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
----
|
||||||
|
====
|
||||||
|
|
||||||
|
You can choose to provide default circuit breaking rules via `SentinelConfigBuilder#rules(rules)`.
|
||||||
|
You can also choose to load circuit breaking rules later elsewhere using
|
||||||
|
`DegradeRuleManager.loadRules(rules)` API of Sentinel, or via Sentinel dashboard.
|
||||||
|
|
||||||
|
===== Reactive Example
|
||||||
|
|
||||||
|
====
|
||||||
|
[source,java]
|
||||||
|
----
|
||||||
|
@Bean
|
||||||
|
public Customizer<ReactiveSentinelCircuitBreakerFactory> defaultCustomizer() {
|
||||||
|
return factory -> factory.configureDefault(id -> new SentinelConfigBuilder(id)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
----
|
||||||
|
====
|
||||||
|
|
||||||
|
==== Specific Circuit Breaker Configuration
|
||||||
|
|
||||||
|
Similarly to providing a default configuration, you can create a `Customizer` bean this is passed a
|
||||||
|
`SentinelCircuitBreakerFactory`.
|
||||||
|
|
||||||
|
====
|
||||||
|
[source,java]
|
||||||
|
----
|
||||||
|
@Bean
|
||||||
|
public Customizer<SentinelCircuitBreakerFactory> slowCustomizer() {
|
||||||
|
String slowId = "slow";
|
||||||
|
List<DegradeRule> rules = Collections.singletonList(
|
||||||
|
new DegradeRule(slowId).setGrade(RuleConstant.DEGRADE_GRADE_RT)
|
||||||
|
.setCount(100)
|
||||||
|
.setTimeWindow(10)
|
||||||
|
);
|
||||||
|
return factory -> factory.configure(builder -> builder.rules(rules), slowId);
|
||||||
|
}
|
||||||
|
----
|
||||||
|
====
|
||||||
|
|
||||||
|
===== Reactive Example
|
||||||
|
|
||||||
|
====
|
||||||
|
[source,java]
|
||||||
|
----
|
||||||
|
@Bean
|
||||||
|
public Customizer<ReactiveSentinelCircuitBreakerFactory> customizer() {
|
||||||
|
List<DegradeRule> rules = Collections.singletonList(
|
||||||
|
new DegradeRule().setGrade(RuleConstant.DEGRADE_GRADE_RT)
|
||||||
|
.setCount(100)
|
||||||
|
.setTimeWindow(10)
|
||||||
|
);
|
||||||
|
return factory -> factory.configure(builder -> builder.rules(rules), "foo", "bar");
|
||||||
|
}
|
||||||
|
----
|
||||||
|
====
|
@ -41,7 +41,7 @@ For more Nacos Server versions, you can download the latest version from https:/
|
|||||||
|
|
||||||
The following sample illustrates how to register a service to Nacos.
|
The following sample illustrates how to register a service to Nacos.
|
||||||
|
|
||||||
* Configuration of pom.xml The following is a complete example of pom.xml:
|
* Configuration of pom.xml The following is a complete example of pom.xml:
|
||||||
|
|
||||||
.pom.xml
|
.pom.xml
|
||||||
[source,xml]
|
[source,xml]
|
||||||
|
@ -114,7 +114,7 @@ All the message types in this code are provided by the `spring-messaging`module.
|
|||||||
|
|
||||||
**The lower layer of Spring Cloud Stream also implements various code abstractions based on the previous code.**
|
**The lower layer of Spring Cloud Stream also implements various code abstractions based on the previous code.**
|
||||||
|
|
||||||
=== How to use Spring Cloud Alibaba RocketMQ Binder ###
|
=== How to use Spring Cloud Alibaba RocketMQ Binder
|
||||||
|
|
||||||
For using the Spring Cloud Alibaba RocketMQ Binder, you just need to add it to your Spring Cloud Stream application, using the following Maven coordinates:
|
For using the Spring Cloud Alibaba RocketMQ Binder, you just need to add it to your Spring Cloud Stream application, using the following Maven coordinates:
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ For example, `TAGS`, `DELAY`, `TRANSACTIONAL_ARG`, `KEYS`, `WAIT_STORE_MSG_OK`,
|
|||||||
MessageBuilder builder = MessageBuilder.withPayload(msg)
|
MessageBuilder builder = MessageBuilder.withPayload(msg)
|
||||||
.setHeader(RocketMQHeaders.TAGS, "binder")
|
.setHeader(RocketMQHeaders.TAGS, "binder")
|
||||||
.setHeader(RocketMQHeaders.KEYS, "my-key")
|
.setHeader(RocketMQHeaders.KEYS, "my-key")
|
||||||
.setHeader("DELAY", "1");
|
.setHeader(MessageConst.PROPERTY_DELAY_TIME_LEVEL, "1");
|
||||||
Message message = builder.build();
|
Message message = builder.build();
|
||||||
output().send(message);
|
output().send(message);
|
||||||
```
|
```
|
||||||
|
@ -257,7 +257,7 @@ To learn more about how dynamic data sources work in Sentinel, refer to https://
|
|||||||
|
|
||||||
=== Support Zuul
|
=== Support Zuul
|
||||||
|
|
||||||
https://github.com/alibaba/Sentinel/wiki/%E7%BD%91%E5%85%B3%E9%99%90%E6%B5%81[参考 Sentinel 网关限流]
|
Refer https://github.com/alibaba/Sentinel/wiki/API-Gateway-Flow-Control[API Gateway Flow Control]
|
||||||
|
|
||||||
If you want to use Sentinel Starter with Zuul, you need to add the `spring-cloud-alibaba-sentinel-gateway` dependency, and you need to add the `spring-cloud-starter-netflix-zuul` dependency to let Zuul AutoConfiguration class in the gateway module takes effect:
|
If you want to use Sentinel Starter with Zuul, you need to add the `spring-cloud-alibaba-sentinel-gateway` dependency, and you need to add the `spring-cloud-starter-netflix-zuul` dependency to let Zuul AutoConfiguration class in the gateway module takes effect:
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ If you want to use Sentinel Starter with Zuul, you need to add the `spring-cloud
|
|||||||
|
|
||||||
=== Support Spring Cloud Gateway
|
=== Support Spring Cloud Gateway
|
||||||
|
|
||||||
https://github.com/alibaba/Sentinel/wiki/%E7%BD%91%E5%85%B3%E9%99%90%E6%B5%81[参考 Sentinel 网关限流]
|
Refer https://github.com/alibaba/Sentinel/wiki/API-Gateway-Flow-Control[API Gateway Flow Control]
|
||||||
|
|
||||||
If you want to use Sentinel Starter with Spring Cloud Gateway, you need to add the `spring-cloud-alibaba-sentinel-gateway` dependency and add the `spring-cloud-starter-gateway` dependency to let Spring Cloud Gateway AutoConfiguration class in the module takes effect:
|
If you want to use Sentinel Starter with Spring Cloud Gateway, you need to add the `spring-cloud-alibaba-sentinel-gateway` dependency and add the `spring-cloud-starter-gateway` dependency to let Spring Cloud Gateway AutoConfiguration class in the module takes effect:
|
||||||
|
|
||||||
@ -301,6 +301,8 @@ If you want to use Sentinel Starter with Spring Cloud Gateway, you need to add t
|
|||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
include::circuitbreaker-sentinel.adoc[]
|
||||||
|
|
||||||
=== Sentinel Endpoint
|
=== Sentinel Endpoint
|
||||||
|
|
||||||
Sentinel provides an Endpoint internally with a corresponding endpoint id of `sentinel`.
|
Sentinel provides an Endpoint internally with a corresponding endpoint id of `sentinel`.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user