{"id":18559142,"url":"https://github.com/linux-china/spring-boot-rsocket-demo","last_synced_at":"2026-03-09T04:05:04.825Z","repository":{"id":35730508,"uuid":"181604300","full_name":"linux-china/spring-boot-rsocket-demo","owner":"linux-china","description":"Spring Boot RSocket Demo with RPC style","archived":false,"fork":false,"pushed_at":"2023-01-26T08:01:18.000Z","size":2513,"stargazers_count":41,"open_issues_count":33,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-02T02:51:14.428Z","etag":null,"topics":["react","rsocket","spring-boot","websocket"],"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/linux-china.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}},"created_at":"2019-04-16T03:01:25.000Z","updated_at":"2024-10-09T04:57:52.000Z","dependencies_parsed_at":"2023-02-14T15:16:16.566Z","dependency_job_id":null,"html_url":"https://github.com/linux-china/spring-boot-rsocket-demo","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/linux-china%2Fspring-boot-rsocket-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Fspring-boot-rsocket-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Fspring-boot-rsocket-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Fspring-boot-rsocket-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linux-china","download_url":"https://codeload.github.com/linux-china/spring-boot-rsocket-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248144159,"owners_count":21054876,"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":["react","rsocket","spring-boot","websocket"],"created_at":"2024-11-06T21:42:09.746Z","updated_at":"2026-03-09T04:04:57.455Z","avatar_url":"https://github.com/linux-china.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Spring Boot RSocket Demo\n========================\n\nSpring Boot RSocket communication with RPC(interface) style.\n\n# How it works?\n\n* Create a Reactive service interface alike following\n\n```java\npublic interface AccountService {\n\n    Mono\u003cAccount\u003e findById(Integer id);\n\n    Flux\u003cAccount\u003e findAll();\n\n}\n```\n\n* On responder side: implement Service Interface and annotate it with @Controller and @MessageMapping to make it exposed as RSocket service.\n\n```java\n@Service\n@Controller\n@MessageMapping(\"org.mvnsearch.account.AccountService\")\npublic class AccountServiceImpl implements AccountService {\n    @Override\n    @MessageMapping(\"findById\")\n    public Mono\u003cAccount\u003e findById(Integer id) {\n        return Mono.just(new Account(id, \"nick:\" + id));\n    }\n\n    @Override\n    @MessageMapping(\"findAll\")\n    public Flux\u003cAccount\u003e findAll() {\n        return Flux.just(new Account(1, \"Jackie\"), new Account(2, \"Tom\"));\n    }\n}\n```\n\n* On requester side: use RSocketRemoteServiceBuilder to build service call stub bean.\n\n```java\n@Configuration\npublic class RSocketConfiguration {\n\n    @Bean\n    public RSocketRequester rsocketRequester(RSocketStrategies strategies) {\n        return RSocketRequester.builder()\n                .dataMimeType(MimeTypeUtils.APPLICATION_JSON)\n                .rsocketStrategies(strategies)\n                .connectWebSocket(URI.create(\"ws://127.0.0.1:8088/rsocket\")).block();\n    }\n\n    @Bean\n    public AccountService accountService(RSocketRequester rsocketRequester) {\n        return RSocketRemoteServiceBuilder.client(rsocketRequester, AccountService.class).build();\n    }\n}\n```\n\n# Browser support\n\nPlease refer [rsocket-react-demo](rsocket-react-demo) for RSocket and React integration.\n\n# Development\n\n### Requirements\n\n* Jdk 1.8+\n* Spring Boot 2.2.4\n\n### Maven Modules\n\n* account-common: Reactive Service API\n* rsocket-rpc-spring-boot-starter: Spring Boot Starter to make RSocket call as RPC style\n* rsocket-responder: supply RSocket services\n* rsocket-requester: consume RSocket services\n* rsocket-react-demo: call rsocket service from browser\n\n### RSocket acceptor \u0026 handler registry\n\n* acceptor: RSocketMessageHandler.createResponder()\n* all @MessageMapping methods: rsocketMessageHandler.getHandlerMethods()\n\n# References\n\n* Spring RSocket: https://docs.spring.io/spring/docs/5.2.3.RELEASE/spring-framework-reference/web-reactive.html#rsocket\n* Spring Boot RSocket: https://docs.spring.io/spring-boot/docs/2.2.4.RELEASE/reference/html/spring-boot-features.html#boot-features-rsocket\n* RSocket: http://rsocket.io/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinux-china%2Fspring-boot-rsocket-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinux-china%2Fspring-boot-rsocket-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinux-china%2Fspring-boot-rsocket-demo/lists"}