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

How to set read and connect time outs? #53

Closed
Ravisankar-Challa opened this issue Dec 8, 2017 · 5 comments
Closed

How to set read and connect time outs? #53

Ravisankar-Challa opened this issue Dec 8, 2017 · 5 comments
Assignees
Milestone

Comments

@Ravisankar-Challa
Copy link

No description provided.

@andymc12
Copy link
Contributor

andymc12 commented Dec 8, 2017

Good question. In JAX-RS 2.0, read and connect timeouts were set in the Client API using implementation-specific properties - i.e. ClientBuilder.newBuilder().property("com.ibm.ws.jaxrs.client.connection.timeout", 20000)...

In JAX-RS 2.1, the expert group added the connectTimeout and readTimeout to the ClientBuilder class to avoid the user needing to use proprietary (non-portable) properties.

MP Rest Client is based on JAX-RS 2.0, so we could allow implementations of the spec to use those same properties from their JAX-RS 2.0 implementation. Or we could follow suit with JAX-RS 2.1 and add the timeout methods to RestClientBuilder.

Anybody have any strong opinions or alternative options?

@johnament
Copy link
Contributor

I would recommend leaving them as implementation specific properties, since we support registering properties. When we bump to the next version and JAX-RS 2.1 we can align to the methods added in JAX-RS 2.1

@dansiviter
Copy link

This issue might be mitigated somewhat if there was a way to unwrap an instance of the javax.ws.rs.client.ClientBuilder from within the org.eclipse.microprofile.rest.client.RestClientBuilder. At the moment some rather untidy reflection is needed to extract and set. SmallRye tries to map ReSTEasy methods to the #property method but as the method signature of the timeout methods is a long and TimeUnit that makes is somewhat more complicated (see #18).

@andymc12
Copy link
Contributor

@dansiviter I was just thinking about coming back to this issue.

Not all implementations use the ClientBuilder as their underlying technology. I'm not sure about RestEasy, but I know that CXF avoids the ClientBuilder internally, so it would non-trivial to get the ClientBuilder from the generated proxy instance of the Rest Client.

Would it work for you if we added connectTimeout and readTimeout methods to the RestClientBuilder so that it would match JAX-RS 2.1's ClientBuilder?

@dansiviter
Copy link

The concern there is one specific implementation is having a direct impact on specifications for convenience and not for practical reasons. After all, "Rest Client attempts to use JAX-RS 2.0 APIs for consistency and easier re-use." (although in this case it would be JAX-RS 2.1 spec!). Yes, adding connectTimeout and readTimeout would address my specific use-case, but I'm not convinced it's the right thing to do.

@andymc12 andymc12 self-assigned this Oct 23, 2018
@andymc12 andymc12 modified the milestones: Future, 1.2 Oct 23, 2018
@andymc12 andymc12 closed this as completed Nov 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants