# smart-dubbo
**Repository Path**: smartboot/smart-dubbo
## Basic Information
- **Project Name**: smart-dubbo
- **Description**: 适配 dubbo-remoting,将 smart-socket 的通信能力融入 dubbo,提供了除 netty 之外的另外一种选择。
- **Primary Language**: Java
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 3
- **Forks**: 1
- **Created**: 2022-01-27
- **Last Updated**: 2024-02-29
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# smart-dubbo
#### 介绍
适配 dubbo-remoting,将 smart-socket 的通信能力融入 dubbo,提供了除 netty 之外的另外一种选择。
#### 使用教程
1. 引入 Maven 依赖。由于 dubbo 2.7.4.1 之后的版本将接口`org.apache.dubbo.remoting.Server`重命名为`org.apache.dubbo.remoting.RemotingServer`,所以需要根据你当前使用的 Dubbo 版本引入合适的依赖。
```xml
org.smartboot.dubbo
dubbo-remoting-smart-socket
1.0.0-SNAPSHOT
```
```xml
org.smartboot.dubbo
dubbo-remoting-smart-socket-deprecated
1.0.0-SNAPSHOT
```
2. 在 ``中启用 smart-socket 通信服务。
```xml
```
**注意**:
由于 dubbo 本身的限制,要求 Consumer 端与 Provider 端的应用都引入 smart-dubbo 组件才可进行正常的 RPC 通信,否则将会报如下异常:
`Unsupported client type: smart-socket, supported client type is grizzly mina netty netty3 netty4`
所以如果你只是想在单个应用中快速体验 smart-dubbo,可以在工程中创建`META-INF/dubbo/internal`目录,并在该目录下创建文件:`org.apache.dubbo.remoting.Transporter`,再将以下内容拷贝至文件中。
```properties
netty=org.smartboot.dubbo.remoting.transport.SmartSocketTransporter
```
> 这种情况下切勿在``中指定 transporter,保持原有默认的: netty 值即可)
3. 启动 dubbo 服务。为了能够验证 smart-socket 是否生效,我们在快照包中以`System.out`的形式输出了 RPC 的请求与响应消息。所以观察你的控制台或者日志文件,应该会看到类似如下的信息:
```
received msg: Request [id=174945, version=2.0.2, twoway=true, event=true, broken=false, data=null]
send msg: Response [id=174945, version=2.0.2, status=20, event=true, error=null, result=null]
send msg: Request [id=421, version=2.0.2, twoway=true, event=true, broken=false, data=null]
received msg: Response [id=421, version=null, status=20, event=true, error=null, result=null]
```