0

Multiple gRPC Services Example

Hello, coming from a restful Scala play framework world.

I was wondering if anyone knows of any example projects, videos, medium articles related to stringing together multiple services to cal eachother.

All the examples I’ve seen up until this point have been stand alone services that don’t have much interaction with other services.

A key example I’m trying to imagine is a user service. For instance, during the creation of a user multiple other services may need to be called to handle matters related to a new user creation 1. Orders service may be called to create an order 2. Appointments service may be called to schedule a first time appointment 3. Recommendations server may be called to create recommendations

I know from a high level, use the stubs created from the photo definitions of the other services to call these services as part of a user service, create user rpc call, but is this really the case?

Should an rpc call to create user really just use the stubs and implement the logic to the other services?

Thank you in advance.

1 Answers1

0

Yes, to call a service from within a service just use the stubs like normal.

The only interesting aspect is grpc-java supports automatic deadline and cancellation propagation with those RPCs, via io.grpc.Context. There is another answer going into more detail about the propagation.

Eric Anderson
  • 24,057
  • 5
  • 55
  • 76