-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update conformance tests to add a new test exercising client side streaming, which exposed several issues in streaming call implementations. The first issue only affected client streaming (it stopped attempting to read a response from the server once the send side closed - it should have stopped only if the receive side closed). The second issue resulted from not calling close on the channel after the completion message was received, which lead to hangs consuming from `resultChannel()` (it would never complete). After this fix, both examples (for java and javalite) were updated and fixed to correctly exit when finished. Additionally, several cleanups were made to the API (since the current API for client streaming was non-functional - it would only return the initial Headers result and not the message or completion result). This should help resolve reported streaming issues like #100. # API Updates ## `com.connectrpc.BidirectionalStreamInterface` ### Removed * `close()` * Use `sendClose()` instead. This may have confused callers that the close() method would close both send and receive sides of the connection when it was only closing the send side. ## `com.connectrpc.ClientOnlyStreamInterface` ### Added * `sendClose()` * This shouldn't typically need to be called as receiveAndClose() already closes the send side of the stream. * `isSendClosed()` ### Changed * `receiveAndClose()` * Changed to return a ResponseMessage instead of a StreamResult. This allows callers to easily get access to the response as if they were calling a unary method. Previously, the StreamResult would only return the first result retrieved by the call, which typically was a Headers result (leaving callers unable to access the Message or Completion contents). ### Removed * `close()` * Replaced with `sendClose()`. ## `com.connectrpc.ServerOnlyStreamInterface` ### Added * `receiveClose()` * `isReceiveClosed()` ### Removed * `close()` * This closed both the send and receive side of the stream (unlike in other interfaces which just closed the send side). If needed, callers should invoke `receiveClose()` instead (although this isn't necessary in normal use). * `send()` * Callers should invoke `sendAndClose()` instead. Otherwise, reading results from `resultChannel()` will hang since the send side of the stream should be closed before reading responses. ## `com.connectrpc.StreamResult` ### Removed * Removed the `error` field from the base `StreamResult` class. It was never used by the `Headers` or `Message` subclasses and only used on the `Complete` type. This should make it easier for callers to use `Headers` and `Message` types since they don't need to worry about handling `error`.
- Loading branch information
Showing
25 changed files
with
335 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.