Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure timeout options on HttpClient with new API #390

Closed
bclozel opened this issue Jul 12, 2018 · 2 comments
Closed

Configure timeout options on HttpClient with new API #390

bclozel opened this issue Jul 12, 2018 · 2 comments
Labels
for/stackoverflow Questions are best asked on SO or Gitter
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Jul 12, 2018

With the new HttpClient/TcpClient configuration APIs, I've tried customizing the timeout options for the HTTP client.

While I can change the connection timeout like this:

TcpClient tcpClient = TcpClient.create();
tcpClient.configure()
	.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1000);
HttpClient httpClient = HttpClient.from(tcpClient);

I cannot find a way to configure the read and write timeouts, as it was previously explained in this StackOverflow answer. Is there still a way (or an easier way) to configure that part of the HttpClient?

@bclozel bclozel added the for/stackoverflow Questions are best asked on SO or Gitter label Jul 12, 2018
@violetagg
Copy link
Member

violetagg commented Jul 12, 2018

@bclozel You can configure the timeouts like the sample below:

TcpClient tcpClient =
        TcpClient.create()
                 .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1000)
                 .doOnConnected(connection ->
                         connection.addHandlerLast(new ReadTimeoutHandler(10))
                                   .addHandlerLast(new WriteTimeoutHandler(10)));
HttpClient httpClient = HttpClient.from(tcpClient);

@violetagg violetagg added this to the 0.8.0.M1 milestone Jul 12, 2018
@bclozel
Copy link
Member Author

bclozel commented Jul 12, 2018

Thanks a lot @violetagg !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for/stackoverflow Questions are best asked on SO or Gitter
Projects
None yet
Development

No branches or pull requests

2 participants