Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ env:
ALGOLIA_INDEX_NAME: 'prod_kotlin_rpc'
ALGOLIA_KEY: '${{ secrets.ALGOLIA_KEY }}'
CONFIG_JSON_PRODUCT: 'kotlinx-rpc'
CONFIG_JSON_VERSION: '0.5.1'
CONFIG_JSON_VERSION: '0.6.0'

jobs:
build:
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
# 0.6.0
> Published 24 March 2025

### Features 🎉
* 2.1.20 by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/309
* Non suspend flow by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/299

### Documentation 📗
* Update gRPC Docs and Sample by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/284

### Infra 🚧
* Update monitior by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/282
* Fix build config for for-ide builds by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/287
* Update build for custom KC versions by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/293
* Fix kotlin master compilation by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/306

### Other Changes 🧹
* Upgrade Gradle to 8.12.1 by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/286
* Version 0.6.0-SNAPSHOT by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/283
* Update leftover sources from jvm-only to kmp by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/300
* KRPC-129 Move compatibility tests from Toolbox to Kotlin RPC repo by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/304
* Dependency bump by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/303
* Better compiler error message for checked annotations by @Mr3zee in https://github.com/Kotlin/kotlinx-rpc/pull/302

**Full Changelog**: https://github.com/Kotlin/kotlinx-rpc/compare/0.5.1...0.6.0

# 0.5.1
> Published 12 February 2025

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Example of a setup in a project's `build.gradle.kts`:
plugins {
kotlin("multiplatform") version "2.1.20"
kotlin("plugin.serialization") version "2.1.20"
id("org.jetbrains.kotlinx.rpc.plugin") version "0.5.1"
id("org.jetbrains.kotlinx.rpc.plugin") version "0.6.0"
}
```

Expand All @@ -131,15 +131,15 @@ And now you can add dependencies to your project:
```kotlin
dependencies {
// Client API
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-client:0.5.1")
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-client:0.6.0")
// Server API
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-server:0.5.1")
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-server:0.6.0")
// Serialization module. Also, protobuf and cbor are provided
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-serialization-json:0.5.1")
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-serialization-json:0.6.0")

// Transport implementation for Ktor
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-client:0.5.1")
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-server:0.5.1")
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-client:0.6.0")
implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-server:0.6.0")

// Ktor API
implementation("io.ktor:ktor-client-cio-jvm:$ktor_version")
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/kotlinx-rpc/help-versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[
{"version":"0.5.1","url":"/kotlinx-rpc/0.5.1/","isCurrent":true}
{"version":"0.6.0","url":"/kotlinx-rpc/0.6.0/","isCurrent":true}
]
5 changes: 3 additions & 2 deletions docs/pages/kotlinx-rpc/rpc.tree
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
- Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
-->

<!DOCTYPE instance-profile
Expand Down Expand Up @@ -36,10 +36,11 @@
<toc-element topic="strict-mode.topic"/>
<toc-element topic="versions.topic"/>
<toc-element toc-title="Migration guides">
<toc-element topic="0-6-0.topic"/>
<toc-element topic="0-5-0.topic"/>
<toc-element topic="0-4-0.topic"/>
<toc-element topic="0-3-0.topic"/>
<toc-element topic="0-2-4.topic"/>
<toc-element topic="0-2-1.topic"/>
</toc-element>
</instance-profile>
</instance-profile>
24 changes: 24 additions & 0 deletions docs/pages/kotlinx-rpc/topics/0-6-0.topic
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
-->

<!DOCTYPE topic
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
title="Migration to 0.6.0" id="0-6-0">

<p>
Version <code>0.6.0</code> introduces non-breaking changes that require migration.
</p>

<chapter title="Non-suspending flows" id="non-suspending-flows">
<p>
Non-suspending server flows are now supported.
That begins the deprecation cycle for the suspending server flows and stream scopes.
For more details, refer to the Non-suspending server flows and Stream scopes management
sections in the <a href="strict-mode.topic"/> topic.
</p>
</chapter>
</topic>
61 changes: 5 additions & 56 deletions docs/pages/kotlinx-rpc/topics/features.topic
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
- Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
-->

<!DOCTYPE topic
Expand All @@ -25,15 +25,15 @@

@Rpc
interface MyService : RemoteService {
suspend fun sendStream(stream: Flow&lt;Int&gt;): Flow&lt;String&gt;
fun sendStream(stream: Flow&lt;Int&gt;): Flow&lt;String&gt;

suspend fun streamRequest(request: StreamRequest)
}
</code-block>

<p>
Another requirement is that server-side steaming (flows that are returned from a function),
must be the top-level type:
must be the top-level type and the function must be non-suspending:
</p>

<code-block lang="kotlin">
Expand All @@ -45,7 +45,8 @@

@Rpc
interface MyService : RemoteService {
suspend fun serverStream(): Flow&lt;String&gt; // ok
fun serverStream(): Flow&lt;String&gt; // ok
suspend fun serverStream(): Flow&lt;String&gt; // not ok
suspend fun serverStream(): StreamResult // not ok
}
</code-block>
Expand All @@ -55,57 +56,5 @@
<a href="https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md#contextual-serialization">Contextual</a>
annotation.
</note>

<p>
To use flows in your code, use the <code>streamScoped</code> function
that will provide your flows with their lifetime:
</p>

<code-block lang="kotlin">
@Rpc
interface MyService : RemoteService {
suspend fun sendFlow(flow: Flow&lt;Int&gt;)
}

val myService = rpcClient.withService&lt;MyService&gt;()

streamScoped {
val flow = flow {
repeat(10) { i -&gt;
emit(i)
}
}

myService.sendFlow(flow)
}
</code-block>
<p>
In that case all your flows, including incoming and outgoing,
will work until the <code>streamScoped</code> function completes.
After that, all streams that are still live will be closed.
</p>
<p>
You can have multiple RPC calls and flows inside the <code>streamScoped</code> function, including those from
different services.
</p>
<p>
On the server side, you can use the <code>invokeOnStreamScopeCompletion</code> handler inside your methods
to execute code after <code>streamScoped</code> on the client side has closed.
It might be useful to clean resources, for example.
</p>
<warning>
Note that this API is experimental and may be removed in future releases.
</warning>
<p>
Another way of managing streams is to do it manually.
For this, you can use the <code>StreamScope</code> constructor function together with
<code>withStreamScope</code>:
</p>
<code-block lang="kotlin">
val streamScope = StreamScope(myJob)
withStreamScope(streamScope) {
// use streams here
}
</code-block>
</chapter>
</topic>
Loading