Skip to content

Commit bc737b3

Browse files
authored
Added docs for release (#482)
1 parent 25f33cf commit bc737b3

File tree

4 files changed

+92
-16
lines changed

4 files changed

+92
-16
lines changed

docs/pages/kotlinx-rpc/rpc.tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<toc-element topic="versions.topic"/>
4343
<toc-element topic="platforms.topic"/>
4444
<toc-element toc-title="Migration guides">
45+
<toc-element topic="0-10-0.topic"/>
4546
<toc-element topic="0-8-0.topic"/>
4647
<toc-element topic="0-6-0.topic"/>
4748
<toc-element topic="0-5-0.topic"/>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
- Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
4+
-->
5+
6+
<!DOCTYPE topic
7+
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
8+
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
10+
title="Migration to 0.10.0" id="0-10-0">
11+
12+
<p>
13+
Version <code>0.10.0</code> brings some changes that require a migration:
14+
</p>
15+
<list>
16+
<li>
17+
<code>waitForServices</code> parameter in kRPC config is deprecated
18+
and should be replaced with <a href="configuration.topic#connector-dsl"/>
19+
</li>
20+
<li>
21+
As a continuation of the previous point, the backpressure mechanism is now introduced.
22+
You may encounter slowdowns by default when using streams.
23+
Use <a href="configuration.topic#connector-dsl"/>
24+
to configure better suited buffer sizes.
25+
</li>
26+
<li>
27+
For Ktor kRPC integration -
28+
<code>public fun Route.rpc</code> functions now accept a suspending function parameter
29+
instead of a regular one.
30+
</li>
31+
</list>
32+
</topic>

docs/pages/kotlinx-rpc/topics/configuration.topic

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
- Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
3+
- Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
44
-->
55

66
<!DOCTYPE topic
@@ -28,7 +28,7 @@
2828

2929
<code-block lang="kotlin">
3030
val config: KrpcConfig.Client = rpcClientConfig { // same for KrpcConfig.Server with rpcServerConfig
31-
waitForServices = true // default parameter
31+
// configuration here
3232
}
3333
</code-block>
3434
<p>
@@ -67,19 +67,54 @@
6767
You can also define a custom format.
6868
</p>
6969
</chapter>
70-
<chapter id="waitforservices-dsl">
70+
<chapter id="connector-dsl">
7171
<title>
72-
<code>waitForServices</code> DSL
72+
<code>connector</code> DSL
7373
</title>
7474
<p>
75-
<code>waitForServices</code> parameter is available for both client and server.
76-
It specifies the behavior for an endpoint in situations
77-
when the message for a service is received,
78-
but the service is not present in <code>KrpcClient</code> or <code>KrpcServer</code>.
79-
If set to <code>true</code>, the message will be stored in memory,
80-
otherwise, the error will be sent to a peer endpoint,
81-
saying that the message was not handled.
82-
Default value is <code>true</code>.
75+
Connector is a part of kRPC that is responsible for sending and receiving data over the network.
76+
You can configure the following parameters:
8377
</p>
78+
<list>
79+
<li>
80+
<code>waitTimeout</code> - timeout for waiting for a service to be registered.
81+
Sometimes services can be registered after the server starts,
82+
and after the first requests starts to arrive from a peer.
83+
This parameter defines how long the server will wait for a service to be registered.
84+
<br/>
85+
The default value is <code>Duration.INFINITE</code>.
86+
<br/>
87+
Also, available a value of <code>dontWait()</code>.
88+
</li>
89+
<li>
90+
<code>callTimeout</code> - timeout for processing one message.
91+
<br/>
92+
The default value is <code>Duration.INFINITE</code>.
93+
</li>
94+
<li>
95+
<code>perCallBufferSize</code> - size of the buffer for one call.
96+
Call can be a stream or a single message.
97+
This effectively provides a backpressure mechanism.
98+
If a peer is slow to process the message during a call,
99+
the buffer will be filled up and
100+
the sender will wait before sending more messages.
101+
<br/>
102+
Note that this is <b>per call</b>, not per connection.
103+
<br/>
104+
The default value is <code>1</code>.
105+
</li>
106+
</list>
107+
<p>
108+
Example:
109+
</p>
110+
<code-block lang="kotlin">
111+
rpcClientConfig {
112+
connector {
113+
waitTimeout = 10.seconds
114+
callTimeout = 60.seconds
115+
perCallBufferSize = 1000
116+
}
117+
}
118+
</code-block>
84119
</chapter>
85120
</topic>

docs/pages/kotlinx-rpc/topics/krpc-ktor.topic

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,18 @@
2525
<code-block lang="kotlin">
2626
val ktorClient = HttpClient {
2727
installKrpc {
28-
waitForServices = true
28+
serialization {
29+
json()
30+
}
2931
}
3032
}
3133

3234
val rpcClient: KtorKrpcClient =
3335
ktorClient.rpc(&quot;ws://localhost:4242/services&quot;) {
3436
rpcConfig {
35-
waitForServices = false
37+
serialization {
38+
protobuf()
39+
}
3640
}
3741
}
3842

@@ -53,13 +57,17 @@
5357
<code-block lang="kotlin">
5458
fun Application.module() {
5559
install(Krpc) {
56-
waitForServices = true
60+
serialization {
61+
json()
62+
}
5763
}
5864

5965
routing {
6066
rpc(&quot;/services&quot;) {
6167
rpcConfig {
62-
waitForServices = false
68+
serialization {
69+
protobuf()
70+
}
6371
}
6472

6573
registerService&lt;MyService&gt; { MyServiceImpl() }

0 commit comments

Comments
 (0)