【发布时间】:2021-08-19 20:49:23
【问题描述】:
我是 Spring Web Flux 的新手,我有一个使用服务器发送事件的客户端应用程序,事件由服务器随机发布,没有固定延迟。但是如果没有事件,消费者会在 60 秒后抛出io.netty.handler.timeout.ReadTimeoutException: null
服务器端事件消费者代码
webClient.get()
.uri("http://localhost:8080/events")
.accept(MediaType.TEXT_EVENT_STREAM)
.retrieve()
.bodyToFlux(type)
.subscribe(event -> process(event));
即使长时间没有事件,我也需要连接客户端。
完全例外
[36mr.netty.http.client.HttpClientConnect [...] The connection observed an error
io.netty.handler.timeout.ReadTimeoutException: null
reactor.Flux.MonoFlatMapMany.1 onError(org.springframework.web.reactive.function.client.WebClientRequestException: nested exception is io.netty.handler.timeout.ReadTimeoutException)
reactor.Flux.MonoFlatMapMany.1
org.springframework.web.reactive.function.client.WebClientRequestException: nested exception is io.netty.handler.timeout.ReadTimeoutException
at org.springframework.web.reactive.function.client.ExchangeFunctions$DefaultExchangeFunction.lambda$wrapException$9(ExchangeFunctions.java:141) ~[spring-webflux-5.3.5.jar:5.3.5]
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
【问题讨论】:
标签: spring spring-boot spring-webflux project-reactor reactor-netty