Skip to content
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

Access to closeFuture from GRPCAsyncServerCallContext #1954

Open
wSedlacek opened this issue Jun 30, 2024 · 1 comment
Open

Access to closeFuture from GRPCAsyncServerCallContext #1954

wSedlacek opened this issue Jun 30, 2024 · 1 comment

Comments

@wSedlacek
Copy link

Is your feature request related to a problem? Please describe it.

When attempting to write a server side stream there is no layer to obtain the closeFuture to add unsubscribe logic.

Describe the solution you'd like

I would love to simply have access to the closeFuture on the context, or a similar API to provide access to knowing when the client aborts the stream.

The AsyncServerCallContextProvider currently does not require anything with the closeFuture, even though the AsyncServerHandler which conforms to this protocol has the closeFuture passed into it's constructor.

Describe alternatives you've considered

I have looked into hacky work arounds to try to add my own extensions to force the closeFuture to be accessible, but it is buried behind too many layers of internal and private structs and classes.

I have looked into using the async only for unary calls and serve side streaming using the standard nio, but a provider cannot partially implement a service (so the proto would need to be split between two services)

Additional context

I am attempting to add an unsubscribe for a listener that triggers messages to be sent across the response stream.

@glbrntt
Copy link
Collaborator

glbrntt commented Jul 1, 2024

The Task executing the RPC will be cancelled when the RPC closes, you should be able to hook into that to unsubscribe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants