Application is using Spring rest template to call a webservice and i am using
restTemplate.exchage(url) to call the webservice.
Currently we are not passing any timeout value for this webservice call, How can i set a timeout value for Spring Rest template.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
You can use code similar to following for setting connection timeout:
If your wish to set read timeout, you can have code similar to following:
The time is given in milliseconds here. For more info, you can visit the documentation page.
I use this approach based on these threads
CloseableHttpClient httpClient = HttpClients.custom() .setDefaultRequestConfig(requestConfig) .build();
Spring RestTemplate Connection Timeout is not working
Java : HttpClient 4.1.2 : ConnectionTimeout, SocketTimeout values set are not effective