{"id":28185978,"url":"https://github.com/glidea/mini-rpc","last_synced_at":"2025-10-16T07:08:36.413Z","repository":{"id":197237296,"uuid":"390760797","full_name":"glidea/mini-rpc","owner":"glidea","description":"分布式 Rpc 框架。在支持基本调用的前提下，提供重试，熔断，限流，Fallback 等功能","archived":false,"fork":false,"pushed_at":"2021-08-18T11:14:42.000Z","size":110,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-16T06:13:19.827Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/glidea.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}},"created_at":"2021-07-29T15:01:02.000Z","updated_at":"2024-09-13T02:45:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"6583497d-5091-4834-9767-10d50650e28d","html_url":"https://github.com/glidea/mini-rpc","commit_stats":null,"previous_names":["glidea/mini-rpc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/glidea/mini-rpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glidea%2Fmini-rpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glidea%2Fmini-rpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glidea%2Fmini-rpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glidea%2Fmini-rpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glidea","download_url":"https://codeload.github.com/glidea/mini-rpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glidea%2Fmini-rpc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279164457,"owners_count":26117708,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-16T02:00:06.019Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-05-16T06:13:18.882Z","updated_at":"2025-10-16T07:08:36.382Z","avatar_url":"https://github.com/glidea.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"### 代码模块说明\n\n* consumer、provider、public-interface：framework 的测试代码\n\n* framework\n\n  * **common**：公共包。提供注解，配置，异常，pojo，SpringContext，各类工厂等...\n  * **registry**：封装服务地址的注册与发现。以`ServiceKey`、`ProviderInfo`为中心\n  * **cluster**：提供负载均衡，以及熔断器、限流、Fallback 功能\n  * **proxy**：生成支持同步异步调用的代理对象，并实现`@RpcAutowired`自动注入同步代理的功能，以及暴露异步代理接口`RpcAsyncWrapper`\n  * **invoke**：桥接注册中心，负载均衡。为`proxy`提供同步异步调用，重试机制，以及业务非业务异常的相应处理\n  * **client**：为`invoke`提供异步收发请求相应的功能。以`RpcReqest`、`CompletableFuture\u003cObject\u003e`、`Object`为中心\n  * **server**：启动`server`，并发布服务。同步或异步处理`remoting`递交的`RpcReqest`，以及异常过滤\n  * **remoting**：提供底层通信所需的协议，序列化，压缩等\n  \u003e命名参考了 Dubbo，但是具体含义不能完全等同\n---\n\n### 调用流程图\n\n[![Wxtiy8.png](https://z3.ax1x.com/2021/08/01/Wxtiy8.png)](https://imgtu.com/i/Wxtiy8)\n\n---\n\n### 项目技术点细则（完善中）\n\n* [负载均衡](/docs/负载均衡.md)\n* 异步调用\n* [线程模型](/docs/线程模型.md)\n* 动态代理\n* [注册中心](/docs/注册中心.md)\n* [异常处理](/docs/异常处理.md)\n* [重试机制](/docs/重试机制.md)\n* [熔断](/docs/熔断器.md)\n* 限流\n* [Fallback](/docs/Fallback.md)\n* [协议](/docs/协议.md)\n* [序列化](/docs/序列化.md)\n* 压缩\n* [拓展](/docs/拓展.md)\n* 其它\n\n----\n\n### TODO\n\n- [ ] 健康监测，路由\n- [ ] 启动，关闭流程优化\n- [ ] 添加并发限流\n- [ ] 代码重构\n\n---\n\n### 快速开始\n\n\n* public-interface\n\n  ```java\n  public interface HelloService {\n      String hi(String name);\n  }\n  ```\n\n* Provider\n\n  * HelloServiceImpl\n\n    ```java\n    @RpcService(interfaceClass = HelloService.class)\n    public class HelloServiceImpl implements HelloService {\n    \n        @Override\n        public String hi(String name) {\n            return \"hi!\" + name;\n        }\n    }\n    ```\n\n  * MainApp\n\n    ```java\n    @Configuration\n    @ComponentScan({\"HelloServiceImpl所在包\", \"top.glidea.framework\"})\n    @EnableAspectJAutoProxy\n    public class RpcProviderTestMainApp {\n        public static void main(String[] args) {\n            AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(RpcProviderTestMainApp.class);\n            RpcServer rpcServer = new RpcServer();\n            rpcServer.start();\n        }\n    }\n    ```\n\n  * rpc-config.yml\n\n    ```yaml\n    # 默认端口为8181，更多配置选项及缺省值详见：common.config\n    registry:\n      address: xxxxxxx\n    ```\n\n* Consumer\n\n  * bean\n\n    ```java\n    @Component\n    public class Bean {\n        @RpcAutowired\n        private HelloService helloService;\n    \n        public void testSync() {\n            String echo = helloService.hi(\"myname\");\n        }\n      \n        public void testASync() {\n            RpcAsyncWrapper helloServiceAsync = RpcProxyFactory.getAsync(new ServiceKey(HelloService.class.getName()));\n            CompletableFuture\u003cObject\u003e future = helloServiceAsync.call(\"hi\", \"myname\");\n          \t// futue get or register callback. or other thing that CompletableFuture can do\n        }\n    }\n    ```\n\n  * MainApp\n\n    ```java\n    @Configuration\n    @ComponentScan({\"Bean所在的包\", \"top.glidea.framework\"})\n    @EnableAspectJAutoProxy\n    public class RpcConsumerTestMainApp {\n    \n        public static void main(String[] args) throws Exception {\n            AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(RpcConsumerTestMainApp.class);\n            Bean bean = context.getBean(Bean.class);\n            bean.testSync();\n            bean.testASync();\n        }\n    }\n    ```\n\n  * rpc-config.yml\n\n    ```yaml\n    registry:\n      address: xxxxxxx\n    ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglidea%2Fmini-rpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglidea%2Fmini-rpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglidea%2Fmini-rpc/lists"}