{"id":27734294,"url":"https://github.com/chxuan/easyrpc","last_synced_at":"2025-04-28T13:05:28.772Z","repository":{"id":77439728,"uuid":"47334513","full_name":"chxuan/easyrpc","owner":"chxuan","description":":sunflower:Easy to use RPC framework","archived":false,"fork":false,"pushed_at":"2018-01-20T07:56:15.000Z","size":658,"stargazers_count":42,"open_issues_count":1,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-28T13:03:44.946Z","etag":null,"topics":["boost","c-plus-plus","protobuffer","rpc-framework"],"latest_commit_sha":null,"homepage":"https://github.com/chxuan/easyrpc","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chxuan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2015-12-03T13:43:22.000Z","updated_at":"2024-07-17T08:20:45.000Z","dependencies_parsed_at":"2023-02-26T10:00:27.610Z","dependency_job_id":null,"html_url":"https://github.com/chxuan/easyrpc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chxuan%2Feasyrpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chxuan%2Feasyrpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chxuan%2Feasyrpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chxuan%2Feasyrpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chxuan","download_url":"https://codeload.github.com/chxuan/easyrpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251319612,"owners_count":21570426,"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","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":["boost","c-plus-plus","protobuffer","rpc-framework"],"created_at":"2025-04-28T13:03:31.463Z","updated_at":"2025-04-28T13:05:28.756Z","avatar_url":"https://github.com/chxuan.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"A modern RPC framework based on protobuf \n===============================================\n\n\u003e easyrpc是采用C++开发的，使用方便的RPC库。\n\n![License][1] \n\n## Tutorial\n\n* **Simple server**\n\n    ```cpp\n    #include \"easyrpc/easyrpc.h\"\n    #include \"common.pb.h\"\n    \n    using namespace easyrpc;\n    using namespace std::placeholders;\n\n    void echo(const std::shared_ptr\u003crequest\u003e\u0026 req, const std::shared_ptr\u003cresponse\u003e\u0026 res)\n    {\n        res-\u003eset_response(req-\u003emessage);\n    }\n    \n    int main()\n    {\n        // 1.创建rpc服务器对象\n        // 服务端将采用1个io线程和2个work线程服务\n        auto server = std::make_shared\u003crpc_server\u003e(\"0.0.0.0:8888\", 1, 2);\n\n        // 2.设置路由\n        server-\u003eroute(echo_message::descriptor()-\u003efull_name(), std::bind(echo, _1, _2));\n    \n        // 3.启动事件循环（非阻塞）\n        server-\u003erun();\n\n        std::cin.get();\n        return 0;\n    }\n    ```\n    \n* **Simple client**\n    ```cpp\n    #include \"easyrpc/easyrpc.h\"\n    #include \"common.pb.h\"\n    \n    using namespace easyrpc;\n\n    int main()\n    {   \n        // 1.创建rpc客户端对象\n        // 配置连接地址并设置请求超时为3秒\n        auto client = std::make_shared\u003crpc_client\u003e(\"127.0.0.1:8888\", 3);\n\n        // 2.启动事件循环（非阻塞）\n        client-\u003erun();\n    \n        auto req = std::make_shared\u003cecho_message\u003e();\n        req-\u003eset_str(\"Hello world\");\n        req-\u003eset_num(1024);\n\n        // 3.异步调用echo函数\n        client-\u003ecall(message, [](const std::shared_ptr\u003cresult\u003e\u0026 ret)\n        {\n            log_info \u003c\u003c ret-\u003emessage-\u003eDebugString();\n        });\n    \n        std::cin.get();\n        return 0;\n    }\n    ```\n\n## 开发平台\n\n* Ubuntu17.10 gcc7.2.0\n\n## 依赖性\n\n* boost\n* protobuf\n* c++11\n\n## DONE\n\n* TCP长连接。\n* rpc异步调用。\n* 日志记录。\n* worker线程池处理任务。\n* 客户端请求超时处理。\n* 支持主动推送模式。\n\n## License\nThis software is licensed under the [MIT license][2]. © 2017 chxuan\n\n\n  [1]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square\n  [2]: https://github.com/chxuan/easyrpc/blob/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchxuan%2Feasyrpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchxuan%2Feasyrpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchxuan%2Feasyrpc/lists"}