|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
2 | 2 | <!--
|
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. |
4 | 4 | -->
|
5 | 5 |
|
6 | 6 | <!DOCTYPE topic
|
|
28 | 28 |
|
29 | 29 | <code-block lang="kotlin">
|
30 | 30 | val config: KrpcConfig.Client = rpcClientConfig { // same for KrpcConfig.Server with rpcServerConfig
|
31 |
| - waitForServices = true // default parameter |
| 31 | + // configuration here |
32 | 32 | }
|
33 | 33 | </code-block>
|
34 | 34 | <p>
|
|
67 | 67 | You can also define a custom format.
|
68 | 68 | </p>
|
69 | 69 | </chapter>
|
70 |
| - <chapter id="waitforservices-dsl"> |
| 70 | + <chapter id="connector-dsl"> |
71 | 71 | <title>
|
72 |
| - <code>waitForServices</code> DSL |
| 72 | + <code>connector</code> DSL |
73 | 73 | </title>
|
74 | 74 | <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: |
83 | 77 | </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> |
84 | 119 | </chapter>
|
85 | 120 | </topic>
|
0 commit comments