Sahil
Sahil

Reputation: 71

Springboot Restclient per request timeout configurations

I have a common upstream service with different endpoints. I have created a rest client with default connection and socket configs. Now i want to control request timeouts on per endpoint basis. I am using apache http client with springboot rest client and there is no way to set request config per request. Could anyone help here how to set request config when calling upstream service using rest client. Below is the code snippet ..

restClient.post().uri(uri).headers(httpHeaders -> httpHeaders.setAll(headers)).body(body).retrieve().toEntity(String.class);

We do have httpRequest method on above chain which accept a consumer to manipulate request but req object is of type ClientHttpRequest which is of springboot. With apache http client i can do it easily on HttpPost or other methods by calling setRequestConfig. But unable to do so in rest client call.

Upvotes: 0

Views: 81

Answers (0)

Related Questions