Skip to content

Commit b9b6986

Browse files
DOC-5976 added note about RESP3 for Lettuce SCH
1 parent 6dd2801 commit b9b6986

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

content/develop/clients/lettuce/connect.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,11 @@ for more information about SCH.
266266

267267
To enable SCH on the client, create a `MaintNotificationsConfig` object
268268
and/or a `TimeoutOptions` object
269-
and pass them to the `ClientOptions` builder as shown in the example below:
269+
and pass them to the `ClientOptions` builder as shown in the example below.
270+
Note that SCH also requires the
271+
[RESP3]({{< relref "/develop/reference/protocol-spec#resp-versions" >}})
272+
protocol. Lettuce uses this by default, but make sure you don't set
273+
`protocolVersion(ProtocolVersion.RESP2)` in the `ClientOptions` builder.
270274

271275
```java
272276
import io.lettuce.core.*;
@@ -291,6 +295,9 @@ TimeoutOptions timeoutOptions = TimeoutOptions.builder()
291295
ClientOptions clientOptions = ClientOptions.builder()
292296
.maintNotificationsConfig(maintNotificationsConfig)
293297
.timeoutOptions(timeoutOptions)
298+
// SCH requires RESP3. Don't override the default protocol version
299+
// to RESP2:
300+
// .protocolVersion(ProtocolVersion.RESP2) // <- Wrong
294301
.build();
295302

296303
redisClient.setOptions(clientOptions);

0 commit comments

Comments
 (0)