Reputation: 2597
There are two python gRPC services A
and B
.
Service A
needs to call a rpc on service B
in order to send a response to the client.
Service A
also has an interceptor that adds information to gRPC contexts it uses.
Question:
How can I pass the gRPC context to service B
so I can access those information on gRPC contexts in service B
?
Upvotes: 3
Views: 1507
Reputation: 21
Since you are changing the python object itself, it is not currently possible to pass it in the gRPC call. although you can do this manually by setting your metadata using send_initial_metadata
method of your context and writing a new interceptor in service B
to parse this information stored in invocation_metadata
and setting it in the context of your second service.
Upvotes: 2