I want to set a request timeout for each invocation rest client. Currently I have this:
private Client clientBuilder() {
return new ResteasyClientBuilder()
.establishConnectionTimeout(2, TimeUnit.SECONDS)
.socketTimeout(10, TimeUnit.SECONDS)
.build()
.register(ClientRestLoggingFilter.class)
.register(ObjectMapperContextResolver.class);
}
Problem is, that probably don't work for other methods than get. Whats more, socket Timeout is not timeout for reading full response, but for individual packets. socketTimeout and connectionTimeout information
I am looking solution for RestEasy similar like following in jersey:
import org.glassfish.jersey.client.ClientProperties;
ClientConfig configuration = new ClientConfig();
configuration.property(ClientProperties.CONNECT_TIMEOUT, 1000);
configuration.property(ClientProperties.READ_TIMEOUT, 1000);
Client client = ClientBuilder.newClient(configuration);