Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/justxuewei/rpc-demos
https://github.com/justxuewei/rpc-demos
Last synced: 21 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/justxuewei/rpc-demos
- Owner: justxuewei
- Created: 2021-06-21T06:58:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-06-30T15:05:04.000Z (over 3 years ago)
- Last Synced: 2024-11-09T05:33:33.664Z (3 months ago)
- Language: Go
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RPC Demos
The project shows the RPC demos in Golang including net/rpc, gRPC, etc.
## Contents
- netrpc1: A simplified RPC demo using net/rpc.
- netrpc2: An RPC demo improvement based on netrpc1, the features are
- launch a goroutine to handle an RPC request;
- encapsulate a client for HelloService to ensure the arguments are correct.
- netrpc3: An RPC demo using JsonRPC to call methods across languages.
- netrpcpb: Generate code automatically by customized plug-ins of protobuf.
- kvdb: A kv-pair storage based on RPC.
- rvsrpc: A reversed RPC.
- rpcctx: A RPC with context.
- grpcdm: A gRPC demo.
- grpcstm: A gRPC demo with stream.## Getting Started
### netrpcpb
pbgenerator is a customized protoc-gen-go, which contains the customized plug-ins defined in `pbplug/generator.go`. So the first thing is building the pbgenerator by the following commands.
```shell
cd netrpcpb/pbgenerator \
&& go build \
&& mv ./pbgenerator $PATH/protoc-gen-go-netrpc
```Then, generate the code automatically.
```shell
cd ${PROJECT_ROOT} \
&& protoc --go-netrpc_out=plugins=netrpc:. netrpcpb/hello.proto
```where `${PROJECT_ROOT}` is the path of the root of your project.