The Kotlin implementation of Connect: Protobuf RPC that works.
Release v0.6.1 requires the latest major release (4.x) of the com.google.protobuf
runtime library and updates generated code to require the new version of the library. See https://protobuf.dev/support/cross-version-runtime-guarantee/#major for more details on the Protobuf release policy and https://protobuf.dev/news/2023-12-05/ for documentation on changes to the Java runtime library.
Users wishing to remain on the previous major release (3.x) should use v0.5.1.
.withErrorDetails
to specify error details).Full Changelog: https://github.com/connectrpc/connect-kotlin/compare/v0.6.0...v0.6.1
.withErrorDetails
to specify error details).Full Changelog: https://github.com/connectrpc/connect-kotlin/compare/v0.5.0...v0.5.1
Release v0.6.0 updates connect-kotlin to the latest major release (4.26.0) of the com.google.protobuf
runtime library and updates generated code to require the new version of the library. See https://protobuf.dev/support/cross-version-runtime-guarantee/#major for more details on the Protobuf release policy and https://protobuf.dev/news/2023-12-05/ for documentation on changes to the Java runtime library.
Users are recommended to regenerate code with Protobuf 26.0 or later.
Full Changelog: https://github.com/connectrpc/connect-kotlin/compare/v0.5.0...v0.6.0
Release v0.5.0 includes numerous fixes so that connect-kotlin now passes many test cases in the Connect conformance suite that failed with the previous release. It also includes some clean-up of some of the APIs (and internal implementation) which are not backwards-compatible, but should only require minor changes to user code. See the "API Updates" section below for a list of all changed APIs.
These include some API changes which may require modification to user programs.
com.connectrpc.Code
and com.connectrpc.ResponseMessage
below for more details.com.connectrpc.BidirectionalStreamInterface
sendClose
and receiveClose
are now suspend methodscom.connectrpc.ClientOnlyStreamInterface
sendClose
is now a suspend methodsuspend fun cancel()
, to cancel operation w/out completing itcom.connectrpc.ServerOnlyStreamInterface
receiveClose
is now a suspend methodcom.connectrpc.Code
OK
OK
codefromValue(Int?):Code
changed to return nullable Code?
; an input value of zero returns null
com.connectrpc.UnaryFunction
requestFunction
now accepts a UnaryHTTPRequest
instead of HTTPRequest
com.connectrpc.ResponseMessage
code
property
Success
concrete sub-type does not need a code: code is an error code and does not apply (was previously always OK
)Failure
concrete sub-type now has only the code inside the cause: ConnectException
property (the code
property was redundant)Success
and Failure
concrete sub-types to no longer accept codecom.connectrpc.StreamResult
cause
property to be ConnectException?
instead of Throwable?
com.connectrpc.asConnectException
extension function to transform a Throwable
into a ConnectException
code
property
cause
ConnectException?
for causefold
is now an inline funmaybeFold
has been removed (trivial to accomplish the same thing with fold
and nullable result type)com.connectrpc.UnaryBlockingCall
com.connectrpc.http.HTTPClientInterface
unary
now accepts a UnaryHTTPRequest
instead of HTTPRequest
stream
now accepts a duplex: Boolean
parameter, indicating whether the operation needs to support full-duplex communication with the server (for bidirectional streams)com.connectrpc.http.HTTPRequest
message
or httpMethod
properties
UnaryHTTPRequest
which adds these two propertiesclone
method updated to no longer accept message or http methodcom.connectrpc.http.HTTPResponse
status: Int?
property to indicate the numeric HTTP response codecode
and tracingInfo
properties
tracingInfo
replaced by new status
propertycode
is not needed; it is provided by code property of cause
or inferred from new status
propertycom.connectrpc.http.Stream
send
, sendClose
, and receiveClose
are now suspend methodsisClosed
method removed; use isReceiveClosed
insteadStream
factory function with same signature as previous class constructor except that all three callbacks are now suspend functionscom.connectrpc.okhttp.ConnectOkHttpClient
HTTPClientInterface
com.connectrpc.extensions.GoogleJavaJSONStrategy
registry: com.google.protobuf.TypeRegistry
com.connectrpc.extensions.GoogleJavaProtobufStrategy
registry: com.google.protobuf.ExtensionRegistryLite
com.connectrpc.extensions.GoogleJavaLiteProtobufStrategy
registry: com.google.protobuf.ExtensionRegistryLite
Full Changelog: https://github.com/connectrpc/connect-kotlin/compare/v0.4.0...v0.5.0
Full Changelog: https://github.com/connectrpc/connect-kotlin/compare/v0.3.1...v0.4.0
Full Changelog: https://github.com/connectrpc/connect-kotlin/compare/v0.3.0...v0.3.1
Release v0.3.0 improves the streaming API for bidi and server streaming calls, renames ConnectError to ConnectException to match JVM conventions, and supports passing a separate OkHttp client for use in streaming calls.
Full Changelog: https://github.com/connectrpc/connect-kotlin/compare/v0.2.0...v0.3.0
com.connectrpc.http.HTTPResponse
error
renamed to cause
.com.connectrpc.BidirectionalStreamInterface
resultChannel
renamed to responseChannel
. The channel now returns the response messages from the stream (canceling the channel with a ConnectException if an error occurs).com.connectrpc.ClientOnlyStreamInterface
receiveAndClose
now returns the response message instead of a message wrapped in the ResponseMessage
type. The method will throw a ConnectException on error.com.connectrpc.ConnectError
ConnectException
.Exception
instead of Throwable
.com.connectrpc.ResponseMessage.Failure
error
renamed to cause
.com.connectrpc.ServerOnlyStreamInterface
resultChannel
renamed to responseChannel
. The channel now returns the response messages from the stream (canceling the channel with a ConnectException if an error occurs).com.connectrpc.StreamResult.Complete
error
renamed to cause
.Release v0.2.0 fixes issues seen with streaming calls and addresses compatibility with gRPC servers.
Although connect-kotlin is still in alpha, we try to maintain compatibility between releases. Some of the fixes however required API changes, which are documented below.
Full Changelog: https://github.com/connectrpc/connect-kotlin/compare/v0.1.11...v0.2.0
com.connectrpc.BidirectionalStreamInterface
close()
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
sendClose()
isSendClosed()
receiveAndClose()
close()
sendClose()
.com.connectrpc.ServerOnlyStreamInterface
receiveClose()
isReceiveClosed()
close()
receiveClose()
instead (although this isn't necessary in normal use).send()
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
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
.This is the first release of Connect in the connectrpc
GitHub organization. The package name has changed to com.connectrpc
.
To update from the previous release, change the groupId from build.buf
to com.connectrpc
and the version to 0.1.11
. The artifact names haven't changed.
To migrate to the new package name, a shell script is usually sufficient:
On Linux, or anywhere with GNU sed
:
find . -type f \( -name "*.kt" -o -name "*.java" \) -exec sed -i 's|build.buf.connect|com.connectrpc|g' {} \;
On Mac, or anywhere with BSD sed
:
find . -type f \( -name "*.kt" -o -name "*.java" \) -exec sed -i '' 's|build.buf.connect|com.connectrpc|g' {} \;
When you change your source code, you'll also need to switch to the version of protoc-gen-connect-kotlin
in this repository. If you're using the Buf CLI with the buf.build/bufbuild/connect-kotlin
remote plugin, switch to the buf.build/connectrpc/kotlin
plugin.
We apologize for any inconvenience that this rename causes. We're doing this to prepare Connect for donation to a foundation, which will put it on a better footing for long-term maintenance by multiple stakeholders.
If you encounter any problems or have questions, please reach out to us by filing an issue or joining #connectrpc
in the Gophers Slack.
Full Changelog: https://github.com/connectrpc/connect-kotlin/compare/v0.1.10...v0.1.11
Full Changelog: https://github.com/bufbuild/connect-kotlin/compare/v0.1.9...v0.1.10