-
Notifications
You must be signed in to change notification settings - Fork 896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support gRPC cancellation #5570
Comments
Hi, @ikhoon ~ I understand that this issue requirement is To call Thank you for sharing your idea and implementation outline. // CancellationHandler will defer the cancellation until `ClientRequestContext` to this.
final CancellationHandler handler = new CancellationHandler(); Do you have your idea about this already? |
We can set armeria/grpc/src/main/java/com/linecorp/armeria/internal/client/grpc/ArmeriaChannel.java Line 140 in cc0509a
By the way, this issue is labeled with |
Oh! Got it. |
Currently, Armeria gRPC implementation does not support cancellation at the gRPC level.
https://github.com/grpc/grpc-java/blob/1d6f1f1b4251191bddb9d6605fc8f8152275b6b7/examples/src/main/java/io/grpc/examples/cancellation/CancellationClient.java#L57
When a call is canceled, the upstream sends RST_FRAME. We can make the same effect by calling
RequestContext.cancel()
.It sounds easy but the implementation on the client side could be tricky. On the call path,
ClientInterceptor
is called first, and thenArmeriaChannel
is called.As
ClientRequestContext
is created inArmeriaChannel
,ClientRequestContext
is inaccessible inClientInterceptor
. So our aim to call 'RequestContext.cancel()' is not feasible.The idea I came up with is to add a
ClientInterceptor
in theGrpcClientBuilder
that gets executed first. The interceptor registers aCancellationListener
toCancellationContext
. The reference of the registeredCancellationListener
should be also added toCallOptions
so that we can updateClientRequestContext
to the reference inArmeriaChannel.newCall()
.The text was updated successfully, but these errors were encountered: