I am hoping to use a grpc-node
client to talk to a microservice built in Go
using the go-micro
framework. I am running into an issue where go-micro
defines method names using periods (.
) to separate namespaces and method names, whereas grpc-node
slashes (/
). Is there anyway to configure this pattern to have these two processes talk to each other?
相关问题
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- google-drive can't get push notifications
- Register MicroServices in Azure Active Directory (
- How to reimport module with ES6 import
- Why is `node.js` dying when called from inside pyt
相关文章
- node连接远程oracle报错
- How can make folder with Firebase Cloud Functions
- @angular-cli install fails with deprecated request
- node.js modify file data stream?
- How to resolve hostname to an ip address in node j
- GRPC: make high-throughput client in Java/Scala
- Transactionally writing files in Node.js
- Log to node console or debug during webpack build
The gRPC over HTTP/2 protocol documentation defines that the path is constructed as follows:
with this additional note
So, the Node gRPC client is following the specification, and the alternate format used by go-micro appears to be hard coded in their code generation plugin (here). I would consider that to be a bug.
That being said, there is a viable workaround to match that method name format in the Node gRPC library. When you load a
.proto
file in the Node each client constructor function has aservice
member which is a plain JavaScript object that describes the service. It is a map of method names to method definitions, and each method definition includes apath
member. You can modify the path of each method to match the pattern that go-micro uses, then pass the resulting service object togrpc.makeGenericClientConstructor
to get a new client constructor that connects to the modified service.