{"id":15014265,"url":"https://github.com/xcfyl/drpc","last_synced_at":"2026-02-08T20:34:08.126Z","repository":{"id":176349262,"uuid":"656774216","full_name":"xcfyl/drpc","owner":"xcfyl","description":"基于netty的轻量级rpc框架","archived":false,"fork":false,"pushed_at":"2023-07-18T14:39:05.000Z","size":501,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-10T19:35:52.140Z","etag":null,"topics":["netty","rpc-framework","zookeeper"],"latest_commit_sha":null,"homepage":"https://github.com/xcfyl/drpc","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xcfyl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-21T15:56:14.000Z","updated_at":"2023-06-26T09:05:18.000Z","dependencies_parsed_at":"2024-09-20T10:01:07.960Z","dependency_job_id":null,"html_url":"https://github.com/xcfyl/drpc","commit_stats":{"total_commits":93,"total_committers":2,"mean_commits":46.5,"dds":0.09677419354838712,"last_synced_commit":"521a0f73bbaad8ae4f63a074eba15cda611e41a1"},"previous_names":["xcfyl/drpc","xcfyl/pandarpc","dingqinglei/drpc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xcfyl/drpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcfyl%2Fdrpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcfyl%2Fdrpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcfyl%2Fdrpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcfyl%2Fdrpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xcfyl","download_url":"https://codeload.github.com/xcfyl/drpc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcfyl%2Fdrpc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29242878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T19:36:48.828Z","status":"ssl_error","status_checked_at":"2026-02-08T19:27:12.336Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["netty","rpc-framework","zookeeper"],"created_at":"2024-09-24T19:45:23.440Z","updated_at":"2026-02-08T20:34:08.097Z","avatar_url":"https://github.com/xcfyl.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[TOC]\n\n\n\n# 一、README.md\n\n+ [English](README_EN.md)\n\n# 二、简介\n\n该项目是采用模块化设计思路构建的简易rpc系统，适合rpc原理学习，掌握基本的rpc概念。主要包含如下内容：\n\n1. 基于netty的rpc通信协议格式\n2. 基于zookeeper的注册中心实现\n3. 基于jdk的动态代理\n4. 基于jdk和fastjson的序列化\n5. 基于观察者模式的事件发布机制\n6. 基于责任链模式的rpc客户端和服务端过滤器\n7. rpc路由层设计和实现，主要包括随机路由策略和轮询路由策略\n8. 和springboot的简易整合，支持简单的注解开发\n\n# 三、基本上使用\n\n## 3.1 引入maven依赖\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.xcfyl.drpc\u003c/groupId\u003e\n    \u003cartifactId\u003edrpc-spring-boot-starter\u003c/artifactId\u003e\n    \u003cversion\u003e1.1-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## 3.2 api定义\n\n```java\n@DrpcReference\npublic interface ReplyService {\n    String reply(String message);\n}\n```\n\n## 3.3 api实现定义\n\n```java\n@DrpcService\npublic class ReplyServiceImpl implements ReplyService {\n    @Override\n    public String reply(String message) {\n        return message;\n    }\n}\n```\n\n## 3.4 启用drpc\n\n### 3.4.1 服务提供者\n\n1. 服务提供者启用\n\n```java\n@EnableDrpcServer(scanPackages = \"com.github.xcfyl.drpc\")\n@SpringBootApplication\npublic class ProviderApplication {\n    public static void main(String[] args) {\n        SpringApplication.run(ProviderApplication.class, args);\n    }\n}\n```\n\n2. 服务提供者的配置文件\n\n``` properties\nserver.port=17001\nserver.request.limit=1024\nserver.registry.type=zookeeper\nserver.registry.addr=127.0.0.1:2181\nserver.application.name=app2\nserver.serializer=jdk\n```\n\n### 3.4.2 服务消费者\n\n1. 服务消费者启用\n\n```java\n@EnableDrpcClient(scanPackages = \"com.github.xcfyl.drpc\")\n@SpringBootApplication\npublic class ConsumerApplication {\n    public static void main(String[] args) throws Throwable {\n        SpringApplication.run(ConsumerApplication.class, args);\n    }\n}\n```\n\n2. 服务消费者的配置文件\n\n```properties\nclient.request.timeout=3000\nclient.proxy=jdk\nclient.router=roundrobin\nclient.request.limit=2048\nclient.registry.type=zookeeper\nclient.registry.addr=127.0.0.1:2181\nclient.application.name=client1\nclient.serializer=jdk\nclient.subscribe.retry.times=3\nclient.subscribe.retry.interval=1000\nclient.request.retry.times=1\nclient.request.retry.interval=3000\nclient.reconnect.times=3\nclient.reconnect.interval=1000\n```\n\n### 3.4.3 controller\n\n```java\n@RestController\n@ResponseBody\npublic class ReplyController {\n    @Resource\n    private ReplyService replyService;\n\n    @GetMapping(\"/reply\")\n    public String reply(@RequestParam(\"msg\") String message) {\n        return replyService.reply(message);\n    }\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxcfyl%2Fdrpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxcfyl%2Fdrpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxcfyl%2Fdrpc/lists"}