This is an automated email from the ASF dual-hosted git repository.
dengliming pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shenyu-website.git
The following commit(s) were added to refs/heads/main by this push:
new 6a93c7b807 [ISSUE #614] Update the documentation of the sofa plugin.
(#729)
6a93c7b807 is described below
commit 6a93c7b807c44fdd5eb64e94b528c15ac1e04ab6
Author: lahmxu <[email protected]>
AuthorDate: Mon Aug 29 23:48:02 2022 +0800
[ISSUE #614] Update the documentation of the sofa plugin. (#729)
* [doc: sofa plugin] update the documentation of the sofa plugin
* [doc: version error] fix v2.5.0 version error.
---
docs/plugin-center/proxy/sofa-plugin.md | 191 ++++++++++++++++++---
.../current/plugin-center/proxy/sofa-plugin.md | 184 +++++++++++++++++---
.../version-2.5.0.json | 4 +-
.../plugin-center/proxy/sofa-plugin.md | 184 +++++++++++++++++---
static/img/shenyu/plugin/sofa/check_request_zh.png | Bin 0 -> 117861 bytes
static/img/shenyu/plugin/sofa/close_sofa_en.png | Bin 0 -> 123070 bytes
static/img/shenyu/plugin/sofa/close_sofa_zh.png | Bin 0 -> 117771 bytes
static/img/shenyu/plugin/sofa/enable_sofa_en.png | Bin 0 -> 122698 bytes
static/img/shenyu/plugin/sofa/enable_sofa_zh.png | Bin 0 -> 116875 bytes
.../img/shenyu/plugin/sofa/metadata_config_en.png | Bin 0 -> 207959 bytes
.../img/shenyu/plugin/sofa/metadata_config_zh.png | Bin 0 -> 194772 bytes
.../img/shenyu/plugin/sofa/procedure_chart_en.png | Bin 0 -> 22910 bytes
.../img/shenyu/plugin/sofa/procedure_chart_zh.png | Bin 0 -> 21292 bytes
static/img/shenyu/plugin/sofa/rule_config_en.png | Bin 0 -> 191447 bytes
static/img/shenyu/plugin/sofa/rule_config_zh.png | Bin 0 -> 180405 bytes
.../img/shenyu/plugin/sofa/selector_config_en.png | Bin 0 -> 187973 bytes
.../img/shenyu/plugin/sofa/selector_config_zh.png | Bin 0 -> 182378 bytes
.../shenyu/plugin/sofa/sofa_registry_config_zh.png | Bin 0 -> 116374 bytes
static/img/shenyu/plugin/sofa/sofa_registry_en.png | Bin 0 -> 122670 bytes
.../plugin-center/proxy/sofa-plugin.md | 191 ++++++++++++++++++---
20 files changed, 664 insertions(+), 90 deletions(-)
diff --git a/docs/plugin-center/proxy/sofa-plugin.md
b/docs/plugin-center/proxy/sofa-plugin.md
index 1c9cb4d4ce..33a5fdc3ca 100644
--- a/docs/plugin-center/proxy/sofa-plugin.md
+++ b/docs/plugin-center/proxy/sofa-plugin.md
@@ -1,53 +1,198 @@
---
-title: Sofa Plugin
+title: Sofa Plugin
keywords: ["sofa"]
-description: sofa access shenyu gateway
+description: Sofa Plugin
---
-## Description
+# 1. Overview
-* The sofa plugin is a plugin that converts the Http protocol into the sofa
protocol, and it is also the key to the gateway to realize the sofa
generalization call.
-* The sofa plugin needs to cooperate with metadata to realize the call of Sofa.
+## 1.1 Plugin name
+- Sofa plugin
-## Plugin Setting
+## 1.2 Appropriate scenario
-* Add related dependencies and enable plugin, please refer to: [Quick start
with Sofa](../../quick-start/quick-start-sofa) .
+- Protocol conversion, a plugin that converts http protocol requests into the
sofa framework protocol
+- Service Load Balancing.
-* `Sofa` client access, please refer to: [Sofa
Proxy](../../user-guide/sofa-proxy) .
+## 1.3 Plugin functionality
-* Set selector and rule, please refer to: [Selector And Rule
Config](../../user-guide/admin-usage/selector-and-rule) .
+- Converting http protocol requests to sofa framework protocol.
+## 1.4 Plugin code
-## Metadata
+- Core Module `shenyu-plugin-sofa`
+- Core Class `org.apache.shenyu.plugin.sofa.SofaPlugin`
+## 1.5 Added since which shenyu version
-Each `sofa` interface method, will correspond to a metadata, when the `sofa`
application client access to the `ShenYu` gateway, will be automatically
registered, can be viewed in the `shenyu-admin` background management system of
the BasicConfig --> Metadata management.
+- 2.3.0
+# 2. How to use plugin
+## 2.1 Plugin-use procedure chart
-<img src="/img/shenyu/plugin/sofa/metadata_en.png" width="80%"/>
+
+## 2.2 Import pom
-* AppName: specifies the name of the application to which the metadata belongs.
+```xml
+ <dependency>
+ <groupId>com.alipay.sofa</groupId>
+ <artifactId>rpc-sofa-boot-starter</artifactId>
+ <version>${rpc-sofa-boot-starter.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-client-sofa</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>guava</artifactId>
+ <groupId>com.google.guava</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+```
-* MethodName: the name of the method to call.
+## 2.3 Configure in the client project
-* Path: http request path.
+- Configure the sofa configuration in application.yml.
-* PathDescribe: the description of the path is easy to view.
+```yaml
+com:
+ alipay:
+ sofa:
+ rpc:
+ registry-address: zookeeper://127.0.0.1:2181 # consul # nacos
+ bolt-port: 8888
+shenyu:
+ register:
+ registerType: http #zookeeper #etcd #nacos #consul
+ serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379
#localhost:8848
+ props:
+ username: admin
+ password: 123456
+ client:
+ sofa:
+ props:
+ contextPath: /sofa
+ ipAndPort: sofa
+ appName: sofa
+ port: 8888
+```
-* ParamsType: the parameters are separated by commas (,) in the order of
interface parameter types.
+- Configure the service interface exposed by the sofa service in the xml file
in the resources directory.
+
+```xml
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sofa="http://sofastack.io/schema/sofaboot"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://sofastack.io/schema/sofaboot
https://sofastack.io/schema/sofaboot.xsd"
+ default-autowire="byName">
+ <!-- 示例 sofa 接口 -->
+ <sofa:service ref="sofaSingleParamService"
interface="org.apache.shenyu.examples.sofa.api.service.SofaSingleParamService">
+ <sofa:binding.bolt/>
+ </sofa:service>
+ <!-- 示例 sofa 接口 -->
+ <sofa:service ref="sofaMultiParamService"
interface="org.apache.shenyu.examples.sofa.api.service.SofaMultiParamService">
+ <sofa:binding.bolt/>
+ </sofa:service>
+</beans>
+```
-* RpcExpand: other configurations of the `sofa` interface, which support the
`JSON` format, are as follows:
+## 2.4 Enable plugin
+
+- In shenyu-admin --> BasicConfig --> Plugin --> `sofa` set Status enabled.
+
+ 
+
+
+## 2.5 Config plugin
+
+### 2.5.1 Registry Config
+
+
+
+- `protocol`: Register center protocol, currently supports
zookeeper、consul、nacos.
+- `register`: The service IP and PORT of the registry.
+- `threadpool`:There are five types of business thread pools: `fixed`,
`eager`, `cached`, `limited` and `shared`. The first 4 types correspond to the
thread pools officially provided by dubbo. Let's talk about `shared`, as its
name implies, `all proxy plugins` share a `shared` thread pool, the advantage
of this is that it can reduce the number of thread pools, thereby reducing
memory and improving resource utilization.
+- `corethreads`:The number of core threads in the business thread pool.
+- `threads`:The maximum number of threads in the business thread pool.
+- `queues`:The length of the blocking queue of the business thread pool, 0
means `unbounded blocking queue`.
+
+### 2.5.2 Selector config
+
+> Flow needs to be matched by selector.
+
+
+
+- Automatically configure the selector with the `@ShenyuSofaClient` annotation.
+
+### 2.5.3 Rule Config
+
+> After the traffic has been successfully matched by the selector, it will
enter the rules for the final traffic matching.
+
+
+
+- Automatically configure the selector with the `@ShenyuSofaClient` annotation.
+
+### 2.5.4 Metadata config
+
+> When the `sofa` application client accesses the `Apache ShenYu` gateway, it
will be automatically registered, and can be viewed in the `-shenyu-admin`
backend management system's basic configuration `-->` metadata management, each
`sofa` interface method, will correspond to a metadata.
+
+
+
+- AppName: specifies the name of the application to which the metadata belongs.
+
+- MethodName: the name of the method to call.
+
+- Path: http request path.
+
+- PathDescribe: the description of the path is easy to view.
+
+- ParamsType: the parameters are separated by commas (,) in the order of
interface parameter types.
+
+- RpcExpand: other configurations of the `sofa` interface, which support the
`JSON` format.
+
+ examples:`{"loadbalance":"hash","retries":3,"timeout":-1}`
+
+ - `loadbalance`:Load balancing policy, currently supports roundRobin,
random and hash.
+ - `retries`:Number of retries to call client timeout failures.
+ - `timeout`:Calling the client's timeout time.
+
+- Interface: The fully qualified class name of the `sofa` interface.
+
+- RpcType:choose `sofa`.
+
+## 2.6 Examples
+
+### 2.6.1 Accessing the sofa service via Zookeeper using ShenYu
+
+#### 2.6.1.1 Preparation
+
+- Start `Zookeeper` service.
+- Start `ShenYu Admin`.
+- Start `Shenyu Bootstrap`.
+
+#### 2.6.1.2 Plugin Config
+
+- In shenyu-admin --> BasicConfig --> Plugin --> `sofa` set Status enabled,
And adjust the registry configuration as needed.
+- Adjust to the actual situation
[shenyu-examples-sofa](https://github.com/apache/shenyu/tree/master/shenyu-examples/shenyu-examples-sofa)
application.yml configuration in the project and start it.
+
+#### 2.6.2.6 Request service and check result
+
+
+
+# 3. How to disable plugin
+
+- In `shenyu-admin` --> BasicConfig --> Plugin --> `sofa` set Status disable.
+
+
-```yaml
-{"loadbalance":"hash","retries":3,"timeout":-1}
-```
-* Interface: The fully qualified class name of the `sofa` interface.
-* RpcType:choose `sofa`.
diff --git
a/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/proxy/sofa-plugin.md
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/proxy/sofa-plugin.md
index 4c7e26cabf..4b109f1a1c 100644
---
a/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/proxy/sofa-plugin.md
+++
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/proxy/sofa-plugin.md
@@ -4,46 +4,188 @@ keywords: ["sofa"]
description: sofa插件
---
-## 说明
+# 1. 概述
-* `sofa`插件是将`http协议` 转换成`sofa协议` 的插件,也是网关实现`sofa`泛化调用的关键。
-* `sofa`插件需要配合元数据才能实现`sofa服务`的调用。
+## 1.1 插件名称
+- sofa插件
-## 插件设置
+## 1.2 适用场景
-* 引入相关依赖,开启插件,请参考:[Sofa快速开始](../../quick-start/quick-start-sofa) 。
+- 协议转换,将 http 协议的请求转换成 sofa 框架协议的服务处理的插件
+- 服务负载均衡
-* `Sofa`应用客户端接入,请参考:[Sofa服务接入](../../user-guide/sofa-rpc-proxy) 。
+## 1.3 插件功能
-* 选择器和规则配置,请参考:[选择器和规则管理](../../user-guide/admin-usage/selector-and-rule)。
+- 将 http 协议的请求转换成 sofa 框架协议
-## 元数据
+## 1.4 插件代码
-* 每一个`sofa`接口方法,都会对应一条元数据,当`sofa` 应用客户端接入到`Apache ShenYu`网关时,会自动注册,可以在
`shenyu-admin`后台管理系统的基础配置 `-->` 元数据管理中查看。
+- 核心模块`shenyu-plugin-sofa`
+- 核心类`org.apache.shenyu.plugin.sofa.SofaPlugin`
+## 1.5 添加自哪个shenyu版本
-<img src="/img/shenyu/plugin/sofa/metadata.png" width="80%"/>
+- 2.3.0
+# 2. 如何使用插件
-* 应用名称:该条元数据所属的应用名称。
+## 2.1 插件使用流程图
-* 方法名称:需要调用的方法名。
+
-* 路径:`http`请路径。
-
-* 路径描述:对该路径的说明,方便查看。
-
-* 参数类型:按照接口的参数类型顺序,通过半角逗号分隔。
+## 2.2 导入pom
+```xml
+ <dependency>
+ <groupId>com.alipay.sofa</groupId>
+ <artifactId>rpc-sofa-boot-starter</artifactId>
+ <version>${rpc-sofa-boot-starter.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-client-sofa</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>guava</artifactId>
+ <groupId>com.google.guava</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+```
+## 2.3 在客户端项目中配置
-* Rpc扩展参数:`sofa`接口的其他配置,支持`json`格式,字段如下:
+- 在 application.yml 中配置 sofa 的配置
```yaml
-{"loadbalance":"hash","retries":3,"timeout":-1}
+com:
+ alipay:
+ sofa:
+ rpc:
+ registry-address: zookeeper://127.0.0.1:2181 # consul # nacos
+ bolt-port: 8888
+shenyu:
+ register:
+ registerType: http #zookeeper #etcd #nacos #consul
+ serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379
#localhost:8848
+ props:
+ username: admin
+ password: 123456
+ client:
+ sofa:
+ props:
+ contextPath: /sofa
+ ipAndPort: sofa
+ appName: sofa
+ port: 8888
```
-* 服务接口:`sofa`接口的全限定类名。
+- 在 resources 目录下xml 文件中配置 sofa 服务暴露的服务接口
+
+```xml
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sofa="http://sofastack.io/schema/sofaboot"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://sofastack.io/schema/sofaboot
https://sofastack.io/schema/sofaboot.xsd"
+ default-autowire="byName">
+ <!-- 示例 sofa 接口 -->
+ <sofa:service ref="sofaSingleParamService"
interface="org.apache.shenyu.examples.sofa.api.service.SofaSingleParamService">
+ <sofa:binding.bolt/>
+ </sofa:service>
+ <!-- 示例 sofa 接口 -->
+ <sofa:service ref="sofaMultiParamService"
interface="org.apache.shenyu.examples.sofa.api.service.SofaMultiParamService">
+ <sofa:binding.bolt/>
+ </sofa:service>
+</beans>
+```
+
+## 2.4 启用插件
+
+- 在 `shenyu-admin` --> 基础配置 --> 插件管理-> `sofa` ,设置为开启。
+
+ 
+
+
+## 2.5 配置插件
+
+### 2.5.1 配置注册中心参数
+
+
+
+- `protocol`: 注册中心协议,目前支持 zookeeper、consul、nacos。
+- `register`: 注册中心的服务 IP 和 PORT。
+-
`threadpool`:业务线程池类型,有`fixed`、`eager`、`cached`、`limited`和`shared`共5种类型,前面4种与dubbo官方提供的线程池一一对应,不多解释,这里单独说下`shared`,正如其名,`所有proxy插件`共用一个`shared`线程池,这样做的好处是能够减少线程池数量,进而降低内存、提高资源利用率。
+- `corethreads`:业务线程池核心线程数。
+- `threads`:业务线程池最大线程数。
+- `queues`:业务线程池阻塞队列长度,0表示`无界阻塞队列`。
+
+### 2.5.2 选择器配置
+
+> 流量需要经过选择器匹配。
+
+
+
+- 通过`@ShenyuSofaClient`注解自动配置选择器。
+
+### 2.5.3 规则配置
+
+> 流量经过选择器匹配成功之后,会进入规则来进行最终的流量匹配。
+
+
+
+- 通过`@ShenyuSofaClient`注解自动配置选择器。
+
+### 2.5.4 元数据配置
+
+> 当`sofa` 应用客户端接入到`Apache ShenYu`网关时,会自动注册,可以在 `shenyu-admin`后台管理系统的基础配置 `-->`
元数据管理中查看,每一个`sofa`接口方法,都会对应一条元数据。
+
+
+
+- 应用名称:该条元数据所属的应用名称。
+
+- 方法名称:需要调用的方法名。
+
+- 路径:`http`请路径。
+
+- 路径描述:对该路径的说明,方便查看。
+
+- 参数类型:按照接口的参数类型顺序。
+
+- Rpc扩展参数:接口的扩展参数配置,`json`格式。
+
+ 示例:`{"loadbalance":"hash","retries":3,"timeout":-1}`
+
+ - `loadbalance`:负载均衡策略,当前支持 roundRobin、random 和 hash。
+ - `retries`:调用客户端超时失败的重试次数。
+ - `timeout`:调用客户端的超时时间。
+
+- 服务接口:`sofa`接口的全限定类名。
+- `Rpc`类型:下拉选择 `sofa`。
+
+## 2.6 示例
+
+### 2.6.1 使用 ShenYu 访问 sofa 服务
+
+#### 2.6.1.1 准备工作
+
+- 启动 `Zookeeper` 服务注册发现中心
+- 启动 `ShenYu Admin`。
+- 启动 `Shenyu Bootstrap`。
+
+#### 2.6.1.2 插件配置
+
+- 打开插件,在 `shenyu-admin` --> 基础配置 --> 插件管理-> `sofa` ,设置为开启,并且根据需要调整注册中心配置。
+- 根据实际情况调整
[shenyu-examples-sofa](https://github.com/apache/shenyu/tree/master/shenyu-examples/shenyu-examples-sofa)
项目中 application.yml 配置并启动。
+
+#### 2.6.2.6 请求服务并且验证结果
+
+
+
+# 3. 如何禁用插件
+
+- 在 shenyu-admin --> 基础配置 --> 插件管理 --> 关闭 sofa 插件状态
-* `Rpc`类型:下拉选择 `sofa`。
+
diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-2.5.0.json
b/i18n/zh/docusaurus-plugin-content-docs/version-2.5.0.json
index 89d0fdea76..ff4656a7b8 100644
--- a/i18n/zh/docusaurus-plugin-content-docs/version-2.5.0.json
+++ b/i18n/zh/docusaurus-plugin-content-docs/version-2.5.0.json
@@ -1,7 +1,7 @@
{
"version.label": {
- "message": "2.4.3",
- "description": "The label for version 2.4.3"
+ "message": "2.5.0",
+ "description": "The label for version 2.5.0"
},
"sidebar.tutorialSidebar.category.Design": {
"message": "设计文档",
diff --git
a/i18n/zh/docusaurus-plugin-content-docs/version-2.5.0/plugin-center/proxy/sofa-plugin.md
b/i18n/zh/docusaurus-plugin-content-docs/version-2.5.0/plugin-center/proxy/sofa-plugin.md
index 4c7e26cabf..d97bd60e86 100644
---
a/i18n/zh/docusaurus-plugin-content-docs/version-2.5.0/plugin-center/proxy/sofa-plugin.md
+++
b/i18n/zh/docusaurus-plugin-content-docs/version-2.5.0/plugin-center/proxy/sofa-plugin.md
@@ -4,46 +4,188 @@ keywords: ["sofa"]
description: sofa插件
---
-## 说明
+# 1. 概述
-* `sofa`插件是将`http协议` 转换成`sofa协议` 的插件,也是网关实现`sofa`泛化调用的关键。
-* `sofa`插件需要配合元数据才能实现`sofa服务`的调用。
+## 1.1 插件名称
+- sofa插件
-## 插件设置
+## 1.2 适用场景
-* 引入相关依赖,开启插件,请参考:[Sofa快速开始](../../quick-start/quick-start-sofa) 。
+- 协议转换,将 http 协议的请求转换成 sofa 框架协议的服务处理的插件
+- 服务负载均衡
-* `Sofa`应用客户端接入,请参考:[Sofa服务接入](../../user-guide/sofa-rpc-proxy) 。
+## 1.3 插件功能
-* 选择器和规则配置,请参考:[选择器和规则管理](../../user-guide/admin-usage/selector-and-rule)。
+- 将 http 协议的请求转换成 sofa 框架协议
-## 元数据
+## 1.4 插件代码
-* 每一个`sofa`接口方法,都会对应一条元数据,当`sofa` 应用客户端接入到`Apache ShenYu`网关时,会自动注册,可以在
`shenyu-admin`后台管理系统的基础配置 `-->` 元数据管理中查看。
+- 核心模块`shenyu-plugin-sofa`
+- 核心类`org.apache.shenyu.plugin.sofa.SofaPlugin`
+## 1.5 添加自哪个shenyu版本
-<img src="/img/shenyu/plugin/sofa/metadata.png" width="80%"/>
+- 2.3.0
+# 2. 如何使用插件
-* 应用名称:该条元数据所属的应用名称。
+## 2.1 插件使用流程图
-* 方法名称:需要调用的方法名。
+
-* 路径:`http`请路径。
-
-* 路径描述:对该路径的说明,方便查看。
-
-* 参数类型:按照接口的参数类型顺序,通过半角逗号分隔。
+## 2.2 导入pom
+```xml
+ <dependency>
+ <groupId>com.alipay.sofa</groupId>
+ <artifactId>rpc-sofa-boot-starter</artifactId>
+ <version>${rpc-sofa-boot-starter.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-client-sofa</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>guava</artifactId>
+ <groupId>com.google.guava</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+```
+## 2.3 在客户端项目中配置
-* Rpc扩展参数:`sofa`接口的其他配置,支持`json`格式,字段如下:
+- 在 application.yml 中配置 sofa 的配置
```yaml
-{"loadbalance":"hash","retries":3,"timeout":-1}
+com:
+ alipay:
+ sofa:
+ rpc:
+ registry-address: zookeeper://127.0.0.1:2181 # consul # nacos
+ bolt-port: 8888
+shenyu:
+ register:
+ registerType: http #zookeeper #etcd #nacos #consul
+ serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379
#localhost:8848
+ props:
+ username: admin
+ password: 123456
+ client:
+ sofa:
+ props:
+ contextPath: /sofa
+ ipAndPort: sofa
+ appName: sofa
+ port: 8888
```
-* 服务接口:`sofa`接口的全限定类名。
+- 在 resources 目录下xml 文件中配置 sofa 服务暴露的服务接口
+
+```xml
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sofa="http://sofastack.io/schema/sofaboot"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://sofastack.io/schema/sofaboot
https://sofastack.io/schema/sofaboot.xsd"
+ default-autowire="byName">
+ <!-- 示例 sofa 接口 -->
+ <sofa:service ref="sofaSingleParamService"
interface="org.apache.shenyu.examples.sofa.api.service.SofaSingleParamService">
+ <sofa:binding.bolt/>
+ </sofa:service>
+ <!-- 示例 sofa 接口 -->
+ <sofa:service ref="sofaMultiParamService"
interface="org.apache.shenyu.examples.sofa.api.service.SofaMultiParamService">
+ <sofa:binding.bolt/>
+ </sofa:service>
+</beans>
+```
+
+## 2.4 启用插件
+
+- 在 `shenyu-admin` --> 基础配置 --> 插件管理-> `sofa` ,设置为开启。
+
+ 
+
+
+## 2.5 配置插件
+
+### 2.5.1 配置注册中心参数
+
+
+
+- `protocol`: 注册中心协议,目前支持 zookeeper、consul、nacos。
+- `register`: 注册中心的服务 IP 和 PORT。
+-
`threadpool`:业务线程池类型,有`fixed`、`eager`、`cached`、`limited`和`shared`共5种类型,前面4种与dubbo官方提供的线程池一一对应,不多解释,这里单独说下`shared`,正如其名,`所有proxy插件`共用一个`shared`线程池,这样做的好处是能够减少线程池数量,进而降低内存、提高资源利用率。
+- `corethreads`:业务线程池核心线程数。
+- `threads`:业务线程池最大线程数。
+- `queues`:业务线程池阻塞队列长度,0表示`无界阻塞队列`。
+
+### 2.5.2 选择器配置
+
+> 流量需要经过选择器匹配。
+
+
+
+- 通过`@ShenyuSofaClient`注解自动配置选择器。
+
+### 2.5.3 规则配置
+
+> 流量经过选择器匹配成功之后,会进入规则来进行最终的流量匹配。
+
+
+
+- 通过`@ShenyuSofaClient`注解自动配置选择器。
+
+### 2.5.4 元数据配置
+
+> 当`sofa` 应用客户端接入到`Apache ShenYu`网关时,会自动注册,可以在 `shenyu-admin`后台管理系统的基础配置 `-->`
元数据管理中查看,每一个`sofa`接口方法,都会对应一条元数据。
+
+
+
+- 应用名称:该条元数据所属的应用名称。
+
+- 方法名称:需要调用的方法名。
+
+- 路径:`http`请路径。
+
+- 路径描述:对该路径的说明,方便查看。
+
+- 参数类型:按照接口的参数类型顺序。
+
+- Rpc扩展参数:接口的扩展参数配置,`json`格式。
+
+ 示例:`{"loadbalance":"hash","retries":3,"timeout":-1}`
+
+ - `loadbalance`:负载均衡策略,当前支持 roundRobin、random 和 hash。
+ - `retries`:调用客户端超时失败的重试次数。
+ - `timeout`:调用客户端的超时时间。
+
+- 服务接口:`sofa`接口的全限定类名。
+- `Rpc`类型:下拉选择 `sofa`。
+
+## 2.6 示例
+
+### 2.6.1 使用 ShenYu 访问 sofa 服务
+
+#### 2.6.1.1 准备工作
+
+- 启动 `Zookeeper` 服务注册发现中心
+- 启动 `ShenYu Admin`。
+- 启动 `Shenyu Bootstrap`。
+
+#### 2.6.1.2 插件配置
+
+- 打开插件,在 `shenyu-admin` --> 基础配置 --> 插件管理-> `sofa` ,设置为开启,并且根据需要调整注册中心配置。
+- 根据实际情况调整
[shenyu-examples-sofa](https://github.com/apache/shenyu/tree/v2.5.0/shenyu-examples/shenyu-examples-sofa)
项目中 application.yml 配置并启动。
+
+#### 2.6.2.6 请求服务并且验证结果
+
+
+
+# 3. 如何禁用插件
+
+- 在 shenyu-admin --> 基础配置 --> 插件管理 --> 关闭 sofa 插件状态
-* `Rpc`类型:下拉选择 `sofa`。
+
diff --git a/static/img/shenyu/plugin/sofa/check_request_zh.png
b/static/img/shenyu/plugin/sofa/check_request_zh.png
new file mode 100644
index 0000000000..38baa82ac7
Binary files /dev/null and b/static/img/shenyu/plugin/sofa/check_request_zh.png
differ
diff --git a/static/img/shenyu/plugin/sofa/close_sofa_en.png
b/static/img/shenyu/plugin/sofa/close_sofa_en.png
new file mode 100644
index 0000000000..aedad75105
Binary files /dev/null and b/static/img/shenyu/plugin/sofa/close_sofa_en.png
differ
diff --git a/static/img/shenyu/plugin/sofa/close_sofa_zh.png
b/static/img/shenyu/plugin/sofa/close_sofa_zh.png
new file mode 100644
index 0000000000..acb521fdec
Binary files /dev/null and b/static/img/shenyu/plugin/sofa/close_sofa_zh.png
differ
diff --git a/static/img/shenyu/plugin/sofa/enable_sofa_en.png
b/static/img/shenyu/plugin/sofa/enable_sofa_en.png
new file mode 100644
index 0000000000..da1e9c2264
Binary files /dev/null and b/static/img/shenyu/plugin/sofa/enable_sofa_en.png
differ
diff --git a/static/img/shenyu/plugin/sofa/enable_sofa_zh.png
b/static/img/shenyu/plugin/sofa/enable_sofa_zh.png
new file mode 100644
index 0000000000..c6a1224d1b
Binary files /dev/null and b/static/img/shenyu/plugin/sofa/enable_sofa_zh.png
differ
diff --git a/static/img/shenyu/plugin/sofa/metadata_config_en.png
b/static/img/shenyu/plugin/sofa/metadata_config_en.png
new file mode 100644
index 0000000000..1bc8d05ad3
Binary files /dev/null and
b/static/img/shenyu/plugin/sofa/metadata_config_en.png differ
diff --git a/static/img/shenyu/plugin/sofa/metadata_config_zh.png
b/static/img/shenyu/plugin/sofa/metadata_config_zh.png
new file mode 100644
index 0000000000..6547cd82c5
Binary files /dev/null and
b/static/img/shenyu/plugin/sofa/metadata_config_zh.png differ
diff --git a/static/img/shenyu/plugin/sofa/procedure_chart_en.png
b/static/img/shenyu/plugin/sofa/procedure_chart_en.png
new file mode 100644
index 0000000000..842c04c1f0
Binary files /dev/null and
b/static/img/shenyu/plugin/sofa/procedure_chart_en.png differ
diff --git a/static/img/shenyu/plugin/sofa/procedure_chart_zh.png
b/static/img/shenyu/plugin/sofa/procedure_chart_zh.png
new file mode 100644
index 0000000000..945f4aec19
Binary files /dev/null and
b/static/img/shenyu/plugin/sofa/procedure_chart_zh.png differ
diff --git a/static/img/shenyu/plugin/sofa/rule_config_en.png
b/static/img/shenyu/plugin/sofa/rule_config_en.png
new file mode 100644
index 0000000000..061808ff40
Binary files /dev/null and b/static/img/shenyu/plugin/sofa/rule_config_en.png
differ
diff --git a/static/img/shenyu/plugin/sofa/rule_config_zh.png
b/static/img/shenyu/plugin/sofa/rule_config_zh.png
new file mode 100644
index 0000000000..de2f89b01b
Binary files /dev/null and b/static/img/shenyu/plugin/sofa/rule_config_zh.png
differ
diff --git a/static/img/shenyu/plugin/sofa/selector_config_en.png
b/static/img/shenyu/plugin/sofa/selector_config_en.png
new file mode 100644
index 0000000000..3753c625e8
Binary files /dev/null and
b/static/img/shenyu/plugin/sofa/selector_config_en.png differ
diff --git a/static/img/shenyu/plugin/sofa/selector_config_zh.png
b/static/img/shenyu/plugin/sofa/selector_config_zh.png
new file mode 100644
index 0000000000..927c877cf6
Binary files /dev/null and
b/static/img/shenyu/plugin/sofa/selector_config_zh.png differ
diff --git a/static/img/shenyu/plugin/sofa/sofa_registry_config_zh.png
b/static/img/shenyu/plugin/sofa/sofa_registry_config_zh.png
new file mode 100644
index 0000000000..270f4c2baa
Binary files /dev/null and
b/static/img/shenyu/plugin/sofa/sofa_registry_config_zh.png differ
diff --git a/static/img/shenyu/plugin/sofa/sofa_registry_en.png
b/static/img/shenyu/plugin/sofa/sofa_registry_en.png
new file mode 100644
index 0000000000..bba01bc29c
Binary files /dev/null and b/static/img/shenyu/plugin/sofa/sofa_registry_en.png
differ
diff --git a/versioned_docs/version-2.5.0/plugin-center/proxy/sofa-plugin.md
b/versioned_docs/version-2.5.0/plugin-center/proxy/sofa-plugin.md
index 1c9cb4d4ce..0b53910fd9 100644
--- a/versioned_docs/version-2.5.0/plugin-center/proxy/sofa-plugin.md
+++ b/versioned_docs/version-2.5.0/plugin-center/proxy/sofa-plugin.md
@@ -1,53 +1,198 @@
---
-title: Sofa Plugin
+title: Sofa Plugin
keywords: ["sofa"]
-description: sofa access shenyu gateway
+description: Sofa Plugin
---
-## Description
+# 1. Overview
-* The sofa plugin is a plugin that converts the Http protocol into the sofa
protocol, and it is also the key to the gateway to realize the sofa
generalization call.
-* The sofa plugin needs to cooperate with metadata to realize the call of Sofa.
+## 1.1 Plugin name
+- Sofa plugin
-## Plugin Setting
+## 1.2 Appropriate scenario
-* Add related dependencies and enable plugin, please refer to: [Quick start
with Sofa](../../quick-start/quick-start-sofa) .
+- Protocol conversion, a plugin that converts http protocol requests into the
sofa framework protocol
+- Service Load Balancing.
-* `Sofa` client access, please refer to: [Sofa
Proxy](../../user-guide/sofa-proxy) .
+## 1.3 Plugin functionality
-* Set selector and rule, please refer to: [Selector And Rule
Config](../../user-guide/admin-usage/selector-and-rule) .
+- Converting http protocol requests to sofa framework protocol.
+## 1.4 Plugin code
-## Metadata
+- Core Module `shenyu-plugin-sofa`
+- Core Class `org.apache.shenyu.plugin.sofa.SofaPlugin`
+## 1.5 Added since which shenyu version
-Each `sofa` interface method, will correspond to a metadata, when the `sofa`
application client access to the `ShenYu` gateway, will be automatically
registered, can be viewed in the `shenyu-admin` background management system of
the BasicConfig --> Metadata management.
+- 2.3.0
+# 2. How to use plugin
+## 2.1 Plugin-use procedure chart
-<img src="/img/shenyu/plugin/sofa/metadata_en.png" width="80%"/>
+
+## 2.2 Import pom
-* AppName: specifies the name of the application to which the metadata belongs.
+```xml
+ <dependency>
+ <groupId>com.alipay.sofa</groupId>
+ <artifactId>rpc-sofa-boot-starter</artifactId>
+ <version>${rpc-sofa-boot-starter.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-client-sofa</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>guava</artifactId>
+ <groupId>com.google.guava</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+```
-* MethodName: the name of the method to call.
+## 2.3 Configure in the client project
-* Path: http request path.
+- Configure the sofa configuration in application.yml.
-* PathDescribe: the description of the path is easy to view.
+```yaml
+com:
+ alipay:
+ sofa:
+ rpc:
+ registry-address: zookeeper://127.0.0.1:2181 # consul # nacos
+ bolt-port: 8888
+shenyu:
+ register:
+ registerType: http #zookeeper #etcd #nacos #consul
+ serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379
#localhost:8848
+ props:
+ username: admin
+ password: 123456
+ client:
+ sofa:
+ props:
+ contextPath: /sofa
+ ipAndPort: sofa
+ appName: sofa
+ port: 8888
+```
-* ParamsType: the parameters are separated by commas (,) in the order of
interface parameter types.
+- Configure the service interface exposed by the sofa service in the xml file
in the resources directory.
+
+```xml
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sofa="http://sofastack.io/schema/sofaboot"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://sofastack.io/schema/sofaboot
https://sofastack.io/schema/sofaboot.xsd"
+ default-autowire="byName">
+ <!-- 示例 sofa 接口 -->
+ <sofa:service ref="sofaSingleParamService"
interface="org.apache.shenyu.examples.sofa.api.service.SofaSingleParamService">
+ <sofa:binding.bolt/>
+ </sofa:service>
+ <!-- 示例 sofa 接口 -->
+ <sofa:service ref="sofaMultiParamService"
interface="org.apache.shenyu.examples.sofa.api.service.SofaMultiParamService">
+ <sofa:binding.bolt/>
+ </sofa:service>
+</beans>
+```
-* RpcExpand: other configurations of the `sofa` interface, which support the
`JSON` format, are as follows:
+## 2.4 Enable plugin
+
+- In shenyu-admin --> BasicConfig --> Plugin --> `sofa` set Status enabled.
+
+ 
+
+
+## 2.5 Config plugin
+
+### 2.5.1 Registry Config
+
+
+
+- `protocol`: Register center protocol, currently supports
zookeeper、consul、nacos.
+- `register`: The service IP and PORT of the registry.
+- `threadpool`:There are five types of business thread pools: `fixed`,
`eager`, `cached`, `limited` and `shared`. The first 4 types correspond to the
thread pools officially provided by dubbo. Let's talk about `shared`, as its
name implies, `all proxy plugins` share a `shared` thread pool, the advantage
of this is that it can reduce the number of thread pools, thereby reducing
memory and improving resource utilization.
+- `corethreads`:The number of core threads in the business thread pool.
+- `threads`:The maximum number of threads in the business thread pool.
+- `queues`:The length of the blocking queue of the business thread pool, 0
means `unbounded blocking queue`.
+
+### 2.5.2 Selector config
+
+> Flow needs to be matched by selector.
+
+
+
+- Automatically configure the selector with the `@ShenyuSofaClient` annotation.
+
+### 2.5.3 Rule Config
+
+> After the traffic has been successfully matched by the selector, it will
enter the rules for the final traffic matching.
+
+
+
+- Automatically configure the selector with the `@ShenyuSofaClient` annotation.
+
+### 2.5.4 Metadata config
+
+> When the `sofa` application client accesses the `Apache ShenYu` gateway, it
will be automatically registered, and can be viewed in the `-shenyu-admin`
backend management system's basic configuration `-->` metadata management, each
`sofa` interface method, will correspond to a metadata.
+
+
+
+- AppName: specifies the name of the application to which the metadata belongs.
+
+- MethodName: the name of the method to call.
+
+- Path: http request path.
+
+- PathDescribe: the description of the path is easy to view.
+
+- ParamsType: the parameters are separated by commas (,) in the order of
interface parameter types.
+
+- RpcExpand: other configurations of the `sofa` interface, which support the
`JSON` format.
+
+ examples:`{"loadbalance":"hash","retries":3,"timeout":-1}`
+
+ - `loadbalance`:Load balancing policy, currently supports roundRobin,
random and hash.
+ - `retries`:Number of retries to call client timeout failures.
+ - `timeout`:Calling the client's timeout time.
+
+- Interface: The fully qualified class name of the `sofa` interface.
+
+- RpcType:choose `sofa`.
+
+## 2.6 Examples
+
+### 2.6.1 Accessing the sofa service via Zookeeper using ShenYu
+
+#### 2.6.1.1 Preparation
+
+- Start `Zookeeper` service.
+- Start `ShenYu Admin`.
+- Start `Shenyu Bootstrap`.
+
+#### 2.6.1.2 Plugin Config
+
+- In shenyu-admin --> BasicConfig --> Plugin --> `sofa` set Status enabled,
And adjust the registry configuration as needed.
+- Adjust to the actual situation
[shenyu-examples-sofa](https://github.com/apache/shenyu/tree/v2.5.0/shenyu-examples/shenyu-examples-sofa)
application.yml configuration in the project and start it.
+
+#### 2.6.2.6 Request service and check result
+
+
+
+# 3. How to disable plugin
+
+- In `shenyu-admin` --> BasicConfig --> Plugin --> `sofa` set Status disable.
+
+
-```yaml
-{"loadbalance":"hash","retries":3,"timeout":-1}
-```
-* Interface: The fully qualified class name of the `sofa` interface.
-* RpcType:choose `sofa`.