doc: Update docs for Dubbo 2.7.x and 3.x adapter
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
This commit is contained in:
parent
9b7786259e
commit
e0eb63e80e
|
|
@ -1,9 +1,9 @@
|
||||||
# Sentinel Apache Dubbo Adapter (for 2.7.x+)
|
# Sentinel Apache Dubbo Adapter (for 2.7.x+)
|
||||||
|
|
||||||
> Note: 中文文档请见[此处](https://github.com/alibaba/Sentinel/wiki/主流框架的适配#dubbo)。
|
> Note: 中文文档请见[此处](https://sentinelguard.io/zh-cn/docs/open-source-framework-integrations.html)。
|
||||||
|
|
||||||
Sentinel Dubbo Adapter provides service consumer filter and provider filter
|
Sentinel Dubbo Adapter provides service consumer filter and provider filter
|
||||||
for [Apache Dubbo](https://dubbo.apache.org/en-us/) services.
|
for [Apache Dubbo](https://dubbo.apache.org/en/) services.
|
||||||
|
|
||||||
**Note: This adapter only supports Apache Dubbo 2.7.x and above.** For legacy `com.alibaba:dubbo` 2.6.x,
|
**Note: This adapter only supports Apache Dubbo 2.7.x and above.** For legacy `com.alibaba:dubbo` 2.6.x,
|
||||||
please use `sentinel-dubbo-adapter` module instead.
|
please use `sentinel-dubbo-adapter` module instead.
|
||||||
|
|
@ -51,7 +51,7 @@ and will bring the caller's name when doing resource protection.
|
||||||
If `limitApp` of flow rules is not configured (`default`), flow control will take effects on all callers.
|
If `limitApp` of flow rules is not configured (`default`), flow control will take effects on all callers.
|
||||||
If `limitApp` of a flow rule is configured with a caller, then the corresponding flow rule will only take effect on the specific caller.
|
If `limitApp` of a flow rule is configured with a caller, then the corresponding flow rule will only take effect on the specific caller.
|
||||||
|
|
||||||
> Note: Dubbo consumer does not provide its Dubbo application name when doing RPC,
|
> Note: Earlier Dubbo 2.7.x consumer does not provide its Dubbo application name when doing RPC,
|
||||||
> so developers should manually put the application name into *attachment* at consumer side,
|
> so developers should manually put the application name into *attachment* at consumer side,
|
||||||
> then extract it at provider side. Sentinel Dubbo Adapter has implemented a filter (`DubboAppContextFilter`)
|
> then extract it at provider side. Sentinel Dubbo Adapter has implemented a filter (`DubboAppContextFilter`)
|
||||||
> where consumer can carry application name information to provider automatically.
|
> where consumer can carry application name information to provider automatically.
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,15 @@
|
||||||
# Sentinel Apache Dubbo Adapter (for 3.0.5+)
|
# Sentinel Apache Dubbo Adapter (for 3.0.5+)
|
||||||
|
|
||||||
> Note: 中文文档请见[此处](https://github.com/alibaba/Sentinel/wiki/主流框架的适配#dubbo)。
|
> Note: 中文文档请见[此处](https://sentinelguard.io/zh-cn/docs/open-source-framework-integrations.html)。
|
||||||
|
|
||||||
Sentinel Dubbo Adapter provides service consumer filter and provider filter
|
Sentinel Dubbo Adapter provides service consumer filter and provider filter
|
||||||
for [Apache Dubbo](https://dubbo.apache.org/en-us/) services.
|
for [Apache Dubbo](https://dubbo.apache.org/en/) services.
|
||||||
|
|
||||||
**Note: This adapter only supports Apache Dubbo 3.0.5 and above.**
|
**Note: This adapter only supports Apache Dubbo 3.0.5 and above.**
|
||||||
|
For `org.apache:dubbo` 2.7.x, please use `sentinel-apache-dubbo-adapter` module instead.
|
||||||
For legacy `com.alibaba:dubbo` 2.6.x, please use `sentinel-dubbo-adapter` module instead.
|
For legacy `com.alibaba:dubbo` 2.6.x, please use `sentinel-dubbo-adapter` module instead.
|
||||||
|
|
||||||
For `org.apache:dubbo` 2.7.x, please use `sentinel-apache-dubbo-adapter` module instead.
|
To use Sentinel Dubbo 3.x Adapter, you can simply add the following dependency to your `pom.xml`:
|
||||||
|
|
||||||
To use Sentinel Dubbo Adapter, you can simply add the following dependency to your `pom.xml`:
|
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
@ -23,7 +21,7 @@ To use Sentinel Dubbo Adapter, you can simply add the following dependency to yo
|
||||||
|
|
||||||
The Sentinel filters are **enabled by default**. Once you add the dependency,
|
The Sentinel filters are **enabled by default**. Once you add the dependency,
|
||||||
the Dubbo services and methods will become protected resources in Sentinel,
|
the Dubbo services and methods will become protected resources in Sentinel,
|
||||||
which can leverage Sentinel's flow control and guard ability when rules are configured.
|
which can leverage Sentinel's flow control and overload protection ability when rules are configured.
|
||||||
Demos can be found in [sentinel-demo-apache-dubbo](https://github.com/alibaba/Sentinel/tree/master/sentinel-demo/sentinel-demo-apache-dubbo).
|
Demos can be found in [sentinel-demo-apache-dubbo](https://github.com/alibaba/Sentinel/tree/master/sentinel-demo/sentinel-demo-apache-dubbo).
|
||||||
|
|
||||||
If you don't want the filters enabled, you can manually disable them. For example:
|
If you don't want the filters enabled, you can manually disable them. For example:
|
||||||
|
|
@ -34,7 +32,7 @@ If you don't want the filters enabled, you can manually disable them. For exampl
|
||||||
<dubbo:provider filter="-sentinel.dubbo.provider.filter"/>
|
<dubbo:provider filter="-sentinel.dubbo.provider.filter"/>
|
||||||
```
|
```
|
||||||
|
|
||||||
For more details of Dubbo filter, see [here](http://dubbo.apache.org/en-us/docs/dev/impls/filter.html).
|
For more details of Dubbo filter, see [here](https://dubbo.apache.org/zh/docs3-v2/java-sdk/reference-manual/spi/description/filter/).
|
||||||
|
|
||||||
## Dubbo resources
|
## Dubbo resources
|
||||||
|
|
||||||
|
|
@ -43,6 +41,10 @@ The resource for Dubbo services has two granularities: service interface and ser
|
||||||
- Service interface: resourceName format is `interfaceName`, e.g. `com.alibaba.csp.sentinel.demo.dubbo.FooService`
|
- Service interface: resourceName format is `interfaceName`, e.g. `com.alibaba.csp.sentinel.demo.dubbo.FooService`
|
||||||
- Service method: resourceName format is `interfaceName:methodSignature`, e.g. `com.alibaba.csp.sentinel.demo.dubbo.FooService:sayHello(java.lang.String)`
|
- Service method: resourceName format is `interfaceName:methodSignature`, e.g. `com.alibaba.csp.sentinel.demo.dubbo.FooService:sayHello(java.lang.String)`
|
||||||
|
|
||||||
|
> **Note**: Dubbo *group+version+interface* level is also supported in Sentinel Apache Dubbo adapter.
|
||||||
|
> You may just add `-Dcsp.sentinel.dubbo.interface.group.version.enabled=true` JVM property,
|
||||||
|
> then the resource name of the Dubbo interface and method will be prefixed with group and version info.
|
||||||
|
|
||||||
## Flow control based on caller
|
## Flow control based on caller
|
||||||
|
|
||||||
In many circumstances, it's also significant to control traffic flow based on the **caller**.
|
In many circumstances, it's also significant to control traffic flow based on the **caller**.
|
||||||
|
|
@ -54,15 +56,8 @@ and will bring the caller's name when doing resource protection.
|
||||||
If `limitApp` of flow rules is not configured (`default`), flow control will take effects on all callers.
|
If `limitApp` of flow rules is not configured (`default`), flow control will take effects on all callers.
|
||||||
If `limitApp` of a flow rule is configured with a caller, then the corresponding flow rule will only take effect on the specific caller.
|
If `limitApp` of a flow rule is configured with a caller, then the corresponding flow rule will only take effect on the specific caller.
|
||||||
|
|
||||||
> Note: Dubbo consumer does not provide its Dubbo application name when doing RPC,
|
> Note: The adapter provides support for customizing origin parsing logic as well.
|
||||||
> so developers should manually put the application name into *attachment* at consumer side,
|
> You may register your own `DubboOriginParser` implementation to `DubboAdapterGlobalConfig`.
|
||||||
> then extract it at provider side. Sentinel Dubbo Adapter has implemented a filter (`DubboAppContextFilter`)
|
|
||||||
> where consumer can carry application name information to provider automatically.
|
|
||||||
> If the consumer does not use Sentinel Dubbo Adapter but requires flow control based on caller,
|
|
||||||
> developers can manually put the application name into attachment with the key `dubboApplication`.
|
|
||||||
>
|
|
||||||
> Since 1.8.0, the adapter provides support for customizing origin parsing logic. You may register your own `DubboOriginParser`
|
|
||||||
> implementation to `DubboAdapterGlobalConfig`.
|
|
||||||
|
|
||||||
## Global fallback
|
## Global fallback
|
||||||
|
|
||||||
|
|
@ -70,6 +65,7 @@ Sentinel Dubbo Adapter supports global fallback configuration.
|
||||||
The global fallback will handle exceptions and give replacement result when blocked by
|
The global fallback will handle exceptions and give replacement result when blocked by
|
||||||
flow control, degrade or system load protection. You can implement your own `DubboFallback` interface
|
flow control, degrade or system load protection. You can implement your own `DubboFallback` interface
|
||||||
and then register to `DubboAdapterGlobalConfig`.
|
and then register to `DubboAdapterGlobalConfig`.
|
||||||
If no fallback is configured, Sentinel will wrap the `BlockException` as the fallback result.
|
|
||||||
|
|
||||||
Besides, we can also leverage [Dubbo mock mechanism](http://dubbo.apache.org/en-us/docs/user/demos/local-mock.html) to provide fallback implementation of degraded Dubbo services.
|
If no fallback is configured, Sentinel will wrap the `BlockException` with a `RuntimeException` as the fallback result.
|
||||||
|
|
||||||
|
Besides, we can also leverage [Dubbo mock mechanism](https://dubbo.apache.org/zh/docs3-v2/java-sdk/advanced-features-and-usage/service/service-downgrade/) to provide fallback implementation of degraded Dubbo services.
|
||||||
Loading…
Reference in New Issue