{"id":21594178,"url":"https://github.com/justlive1/supine","last_synced_at":"2025-04-10T23:41:00.501Z","repository":{"id":37127939,"uuid":"203974988","full_name":"justlive1/supine","owner":"justlive1","description":"轻量级去中心RPC框架","archived":false,"fork":false,"pushed_at":"2025-01-08T09:00:05.000Z","size":154,"stargazers_count":3,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T20:23:16.875Z","etag":null,"topics":["aio","multicast","rpc"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/justlive1.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}},"created_at":"2019-08-23T10:11:49.000Z","updated_at":"2025-01-08T09:00:08.000Z","dependencies_parsed_at":"2022-08-31T08:30:47.130Z","dependency_job_id":null,"html_url":"https://github.com/justlive1/supine","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justlive1%2Fsupine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justlive1%2Fsupine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justlive1%2Fsupine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justlive1%2Fsupine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justlive1","download_url":"https://codeload.github.com/justlive1/supine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248317732,"owners_count":21083525,"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":["aio","multicast","rpc"],"created_at":"2024-11-24T17:16:24.894Z","updated_at":"2025-04-10T23:41:00.485Z","avatar_url":"https://github.com/justlive1.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# supine\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/vip.justlive/supine/badge.svg)](https://maven-badges.herokuapp.com/maven-central/vip.justlive/supine/)\n[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)\n\n轻量级RPC框架\n\n## 介绍\n\n轻量级去中心的RPC框架\n\n* 使用AIO通讯\n* 采用Multicast进行服务注册发现\n\n\n## 快速开始\n\n\n创建`Maven`项目\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003evip.justlive\u003c/groupId\u003e\n    \u003cartifactId\u003esupine\u003c/artifactId\u003e\n    \u003cversion\u003e${lastVersion}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n或`Gradle`\n\n```\ncompile 'vip.justlive:supine:$lastVersion'\n```\n\n服务端\n\n- 直连方式\n```java\n\nServiceConfig config = new ServiceConfig(10086);\nServiceFactory factory = new ServiceFactory(config);\n\n// 注册服务\nfactory.register(new SayImpl());\nfactory.register(new SayImpl2(), \"2\");\n\nfactory.start();\n```\n\n- multicast注册\n```java\nServiceConfig config = new ServiceConfig(10086);\n\n// 设置注册类型\nconfig.setRegistryType(1);\n\n// 设置注册地址，不设置时使用默认值（234.69.69.69:56969）\nconfig.setRegistryAddress(\"234.69.69.69:56969\");\nServiceFactory factory = new ServiceFactory(config);\n\n// 注册服务\nfactory.register(new SayImpl());\n// 指定服务版本\nfactory.register(new SayImpl2(), \"2\");\n\nfactory.start();\n```\n\n客户端\n\n- 直连方式\n```java\nClientConfig config = new ClientConfig();\n\n// 设置长连接空闲超时时间，默认120秒\nconfig.setIdleTimeout(120);\n\n// 直连时设置服务端地址\nconfig.setRegistryAddress(\"localhost:10086\");\n\n// 是否异步调用，默认为同步\nconfig.setAsync(false);\nReferenceFactory factory = new ReferenceFactory(config);\nfactory.start();\n\n// 创建接口代理\nSay say = factory.create(Say.class);\n// 调用接口\nString result = say.hello(msg);\n```\n\n- multicast方式\n```java\nClientConfig config = new ClientConfig();\n\n// 开启异步调用\nconfig.setAsync(true);\n\nconfig.setRegistryType(1);\n// 指定注册地址，不填则使用默认值（234.69.69.69:56969）\nconfig.setRegistryAddress(\"234.69.69.69:56969\");\nReferenceFactory factory = new ReferenceFactory(config);\nfactory.start();\n\n// 创建指定版本的接口代理\nSay say = factory.create(Say.class, \"2\");\n// 调用接口，注意异步方式返回值为null\nsay.hello(msg);\n\n// 异步方式下需要调用如下方法获取Future\nResultFuture\u003cString\u003e future = ResultFuture.future();\n\n// 设置回调\nfuture.setOnSuccess(System.out::println);\nfuture.setOnFailure(System.out::println);\n\n// 获取结果\nfuture.get();\n// 获取结果，有等待超时时间\nfuture.get(1, TimeUnit.SECONDS);\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustlive1%2Fsupine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustlive1%2Fsupine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustlive1%2Fsupine/lists"}