gRPC - Go v1.29 How can I call gRPC method without proto file?

953 views
Skip to first unread message

David Wang

unread,
May 31, 2021, 5:13:07 AM5/31/21
to grpc.io
Hi all,

I develop a gate to transfer message from different clients to micro services. However, I dont want to change my gate when service rpc has been changed. So my client give the method name and protobuf information ([]byte) to gate, the gate dont have the .proto.go file and just want to use this completed information to call the right gRPC method. I cant find the right API to realize it.
Like: client.Conn().Invoke(ctx, {methodName}, {protobuf marshal by client}, bytes)

Amit Saha

unread,
May 31, 2021, 5:15:55 AM5/31/21
to David Wang, grpc.io

For server, it’s simple to enable it.

For client (i.e in your gate), have a look at http://google.golang.org/grpc/reflection/grpc_reflection_v1alpha to make use of the reflection feature to lookup methods/construct protobuf messages and others.




--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/f4639a89-381a-4c47-8af3-582cd842f3f4n%40googlegroups.com.

David Wang

unread,
May 31, 2021, 5:18:59 AM5/31/21
to grpc.io
Thank you!  This is exactly what i need

Amit Saha

unread,
May 31, 2021, 5:22:28 AM5/31/21
to David Wang, grpc.io

On 31 May 2021, at 7:18 pm, David Wang <wyk843...@gmail.com> wrote:

Thank you!  This is exactly what i need


Reply all
Reply to author
Forward
0 new messages