zrpc is a rpc framework like rpcx and gRPC.
All you need to do is introduce the following into your code, then run go mod tidy
and it will automatically fetch the necessary dependencies.
import "github.com/crazyfrankie/zrpc"
You can find all examples at zrpc/examples
This is a simple example creating servers and clients with zrpc.
server
// define your biz server
s := zrpc.NewServer()
example.RegisterExampleServiceServer(s, &ExampleService{})
s.Server("tcp", ":8080")
client
client := zrpc.NewClient(":8080")
ec := example.NewExampleServiceClient(client)
res, err := ec.ExampleCall(ctx, &ExampleCallRequest{})
zrpc encapsulates the zrpc protocol based on tcp, the protocol framework like this.
Referring to gRPC protoc-gen-go-grpc, the Custom implementation of protoc-gen-go-zrpc, for staking code generation.
At the same time there are also considerations to use the reverse proxy approach, that is, in the Client
to implement the reflection mechanism to dynamically modify the function to avoid code generation, specific ideas in dynamic-agent, will be updated in the future.