Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Easy-RPC

基于 Netty + Nacos 实现的轻量级 Java RPC 框架。

特性

  • 基于 Netty 实现的高性能网络通信
  • 自定义二进制协议,支持请求、响应、心跳三种消息类型
  • 使用 Kryo 进行高效序列化
  • 使用连接池技术,支持连接复用,提高性能
  • 具有客户端心跳保活机制,避免死链接
  • 基于 Nacos 的服务注册与发现
  • 使用 JDK 动态代理,调用远程服务如同调用本地方法

模块结构

easy-RPC
├── rpc-common        # 公共协议类(RpcRequest、RpcResponse、RpcMessage)
├── rpc-core          # 框架核心实现(客户端、服务端、编解码、注册发现)
└── rpc-demo          # 使用示例(Provider、Consumer)

快速开始

环境要求

  • JDK 17+
  • Maven 3.6+
  • Nacos 单机模式

启动 Nacos

# 先进入 nacos\bin 目录下
startup.cmd -m standalone  # Windows

启动服务提供者

运行 rpc-demo 模块下的 ProviderMain

启动服务消费者

运行 rpc-demo 模块下的 ConsumerMain

协议格式

+-------------+--------+--------+------------+----------+
| 魔数(0x5643) |  版本  |   类型  |   数据长度   |  数据体   |
| 2 byte      | 1 byte | 1 byte |   4 byte   |  n byte  |
+-------------+--------+--------+------------+----------+

技术栈

技术 版本 用途
Netty 4.1.x 网络通信
Kryo 5.6.0 序列化
Nacos Client 2.4.3 服务注册发现
Commons Pool2 2.12.0 Kryo 对象池
Lombok 1.18.x 代码简化

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages