-
Notifications
You must be signed in to change notification settings - Fork 177
Description
I was trying to implement a cascade gRPC (say gRPC service A and gRPC service B), where service A launches B and immediately returns, and B is a server-streaming call.
My problem is that the service B is not successfully executed. Not sure if it was cancelled silently.
Inside service A (gRPC unary call), I implemented like below:
// inside service A
val threadLocalContext = Context.current().fork()
threadLocalContext.run {
CoroutineScope(GrpcContextElement(threadLocalContext)).launch{
// intends to call service B here but not successful. Seems nothing happens.
val result = serviceBStub.invokeServerStreamingService(serviceBRequest)
}
}
// service A exitsBut it turns out that the service B server streaming call was never invoked. If I change B to a unary call it can successfully execute. So it seems that thread local is propagated, but I am not sure if this is the case in server streaming call situation.
Or if the server streaming call was cancelled? I did not see any exceptions being thrown.
Can someone tell me what went wrong and how to make it behave as intended? Thanks!