I need to write a library works for spring-boot-2.1.6 which uses reactor-netty:0.8.9.RELEASE.
How can I set connect/write/read timeout on an instance of HttpClient and/or on an instance of TcpClient?
I just found that I can set a connection timeout like this.
final HttpClient httpClient = HttpClient.create()
.tcpConfiguration(tc -> {
Optional.ofNullable(getConnectTimeout())
.map(Duration::toMillis)
.map(Math::toIntExact)
.ifPresent(ct -> {
tc.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, ct);
});
return tc;
});
Is that right? And how can I set write/read time out?
you can set read/write timeout like this:
Use it like this: