0

Let's just say you have 2 services: Books and Customers. Let's say a customer wants to favorite a book. So the customer might make an gRPC request to the next service. How exactly can you make an RPC call from one service to another.

This is the only example on the web. it seems that shows this, but the problem is they use golang to for intraservice request (as a client), and use grpc-node as a server. Is there an example where grpc-node makes a client-side RPC call to a grpc-node server from another service?

checkout service file: https://github.com/GoogleCloudPlatform/microservices-demo/blob/master/src/checkoutservice/main.go Proto file: https://github.com/GoogleCloudPlatform/microservices-demo/blob/master/pb/demo.proto

At the moment, I would assume there would be 2 services in a shared proto file, and in the client file the client would call an RPC call with components of another service.

TheRoadLessTaken
  • 531
  • 2
  • 7
  • 15

1 Answers1

2

IIUC you want: client <--> service1 <--> service2 and each service is implemented using gRPC.

The implementation will be:

  • client <--> service1
  • service1 client (!) <--> service2

Namely, your implementation of service1 must function as a gRPC server and a gRPC client (making a call against service2)

Part of gRPC's "magic" is that permits you to invoke remote functions|methods as if that function|method were implemented locally. But, that's it. There's no further magic in daisy-chaining these method calls.

So, if functions are implemented using other functions, it's gRPC client-server turtles all the way down.

DazWilkin
  • 32,823
  • 5
  • 47
  • 88