How to cancel gRPC call from client side? #34650
-
There is a 3rd party server which is streaming to my quarkus app (3.2.0.Final) with oneToMany (input -> output Multi). And I need to close the connection on certain condition (by filtering Object status of last event). Otherwise the server can't understand that the stream must be closed after the last event it sent to the client and right now the only way I ve found is to use deadLine to close such connection. I'm using Mutiny gRPC generation in my app and I can't understand how to implement it using it. Any help appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
/cc @alesj (grpc), @cescoffier (grpc) |
Beta Was this translation helpful? Give feedback.
-
I would need more details about your code. I can see two ways: If the client sends a stream, sending the completion signal should close the connection If you consume a stream from the server, you have a subscription on it. Calling cancel on that subscription will close the connection. |
Beta Was this translation helpful? Give feedback.
-
Related to this discussion, following issues looks interesting:
With this PR potentially fixing #47555 it. |
Beta Was this translation helpful? Give feedback.
It might be possible that the service does not handle the cancellation correctly. Unfortunately, if that's the case, I don't think there will be any good solution.
You can try to run Wireshark and check the frames.