{"id":21172932,"url":"https://github.com/lucassaldanha/vertx-jsonrpc","last_synced_at":"2025-06-11T03:36:33.930Z","repository":{"id":68240478,"uuid":"202277969","full_name":"lucassaldanha/vertx-jsonrpc","owner":"lucassaldanha","description":"JSON-RPC 2.0 service implemented in Java using Vert.x 4","archived":false,"fork":false,"pushed_at":"2021-03-26T03:02:01.000Z","size":100,"stargazers_count":8,"open_issues_count":5,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T06:41:22.440Z","etag":null,"topics":["json-rpc","vertx"],"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/lucassaldanha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2019-08-14T05:02:20.000Z","updated_at":"2024-11-30T15:58:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"fc1b2a46-6ae6-4b10-b057-005b5a46a8c3","html_url":"https://github.com/lucassaldanha/vertx-jsonrpc","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/lucassaldanha%2Fvertx-jsonrpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucassaldanha%2Fvertx-jsonrpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucassaldanha%2Fvertx-jsonrpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucassaldanha%2Fvertx-jsonrpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucassaldanha","download_url":"https://codeload.github.com/lucassaldanha/vertx-jsonrpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucassaldanha%2Fvertx-jsonrpc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259192202,"owners_count":22819433,"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":["json-rpc","vertx"],"created_at":"2024-11-20T16:31:12.120Z","updated_at":"2025-06-11T03:36:33.922Z","avatar_url":"https://github.com/lucassaldanha.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON-RPC 2.0 Service\n\nThis is an example implementation of a JSON-RPC 2.0 service in Java using \n[Vert.x](https://vertx.io/) 4.\n\nThe main principles behind this implementation are:\n- [JSON-RPC 2.0 spec](https://www.jsonrpc.org/specification) compliant\n- Channel agnostic: Thin integration layer between the JSON-RPC code and the transport channel \n(e.g. HTTP, WebSockets, IPC, etc)\n- Extendable: New JSON-RPC methods can be added with low effort\n\nThis project started as a prototype and now it can help others also implementing JSON-RPC services \nusing Vert.x.\n\n## Architecture\nThere are three main components in this architecture: \n- JsonRpcServer\n- JsonRpcMessageProcessor\n- JsonRpcMethodRegistry\n\nThe first three components have been implemented as \n[Verticles](https://vertx.io/docs/vertx-core/java/#_verticles) and communicate via the \n[EventBus](https://vertx.io/docs/vertx-core/java/#_verticles).\n\n### JsonRpcServer\nThe server is responsible for the handling different channels. For example. the HttpJsonRpcServer \nhandles HTTP requests.\n\nFor each different channel that we want to support, we need a new JsonRpcServer that will \nencode/decode messaged from the channel to the JsonRpcMessageProcessor.\n\n### JsonRpcMessageProcessor\nThe processor is a main piece in the JSON-RPC service. It is responsible for parsing the messages \nreceived from the server and decoding it into a JSON-RPC request. On a successful decoding, the \nprocessor will dispatch the request to the respective JSON-RPC method to get a result.\n\n### JsonRpcMethodRegistry\nThe registry is where all implemented JSON-RPC methods are registered and made available to the\napplication. For each JsonRpcMethod, the registry will setup the proper listeners on the EventBus.\nEach JSON-RPC method should implement the JsonRpcMethod interface and be registered in the registry \nto be available. There are two example methods implemented, one to add and one to subtract numbers.\n\n## Example\n```\n--\u003e request\n\u003c-- response\n\n--\u003e { \"jsonrpc\": \"2.0\", \"id\": \"1\", \"method\": \"add\", \"params\": [2, 3] }\n\u003c-- { \"jsonrpc\": \"2.0\", \"id\": \"1\", \"result\": 5 }\n\n--\u003e { \"jsonrpc\": \"2.0\", \"id\": \"1\", \"method\": \"subtract\", \"params\": [5, 1] }\n\u003c-- { \"jsonrpc\": \"2.0\", \"id\": \"1\", \"result\": 4 }\n```\n\nIf you want to test yourself, run Main.java and use the following command:\n```\n$ curl --request POST \\\n  --url http://localhost:8080 \\\n  --data '{\"jsonrpc\": \"2.0\", \"method\": \"add\", \"params\": [2, 3], \"id\": \"1\"}'\n\n${\"jsonrpc\":\"2.0\",\"id\":\"1\",\"result\":5}\n```\n(by default, the application starts a HTTP server listening on port 8080)\n\n## Missing features\n- Support for by-name parameters\n- Extended config option (e.g. http server listening port)\n- Global error handler\n- Nested method namespacing","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucassaldanha%2Fvertx-jsonrpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucassaldanha%2Fvertx-jsonrpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucassaldanha%2Fvertx-jsonrpc/lists"}