当使用jetStream 出现"Timeout or no response waiting for NATS JetStream server" 错误的时候要注意后面的“no response”,尤其是开发测试,要去check server 是否启动了 jet stream。
[20112] 2025/01/24 08:27:42.738396 [INF] _ ___ _____ ___ _____ ___ ___ _ __ __
[20112] 2025/01/24 08:27:42.738396 [INF] _ | | __|_ _/ __|_ _| _ \ __| /_\ | \/ |
[20112] 2025/01/24 08:27:42.738396 [INF] | || | _| | | \__ \ | | | / _| / _ \| |\/| |
[20112] 2025/01/24 08:27:42.738396 [INF] \__/|___| |_| |___/ |_| |_|_\___/_/ \_\_| |_|
[20112] 2025/01/24 08:27:42.738396 [INF]
[20112] 2025/01/24 08:27:42.738396 [INF] https://docs.nats.io/jetstream
[20112] 2025/01/24 08:27:42.738396 [INF]
[20112] 2025/01/24 08:27:42.738396 [INF] ---------------- JETSTREAM ----------------
[20112] 2025/01/24 08:27:42.738396 [INF] Max Memory: 35.78 GB
[20112] 2025/01/24 08:27:42.738396 [INF] Max Storage: 1.00 TB
[20112] 2025/01/24 08:27:42.738396 [INF] Store Directory: "C:\Users\79162\AppData\Local\Temp\nats\jetstream"
[20112] 2025/01/24 08:27:42.738396 [INF] -------------------------------------------
my launch.json content is
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "main.go",
"args": ["-V","--jetstream"]
}
]
}
ps: my timeout setting code for debugging
Options options = new Options.Builder().
server("nats://127.0.0.1:4222")
.socketWriteTimeout(Duration.ofSeconds(1010))
.socketReadTimeoutMillis(60*1000*10)
.connectionTimeout(Duration.ofSeconds(59)) // Set timeout
.build();
be attention: connectionTimeout must less than socketWriteTimeout