Update document for Sentinel
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
=== 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`.
|
||||
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.
|
||||
|
||||
|
||||
==== 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);
|
||||
}
|
||||
----
|
||||
====
|
||||
@@ -20,6 +20,7 @@ breaker implementation that best fits your needs for your app.
|
||||
|
||||
* https://github.com/Netflix/Hystrix[Netfix Hystrix]
|
||||
* https://github.com/resilience4j/resilience4j[Resilience4J]
|
||||
* https://github.com/alibaba/Sentinel[Sentinel]
|
||||
|
||||
== Core Concepts
|
||||
|
||||
@@ -96,6 +97,9 @@ include::spring-cloud-circuitbreaker-hystrix.adoc[]
|
||||
|
||||
include::spring-cloud-circuitbreaker-resilience4j.adoc[]
|
||||
|
||||
|
||||
include::spring-cloud-circuitbreaker-sentinel.adoc[]
|
||||
|
||||
== Building
|
||||
|
||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/building-jdk8.adoc[]
|
||||
|
||||
Reference in New Issue
Block a user