Hi,

I am trying to set my rest template timeout over 120 seconds. But it is not working. It is keep timing out around 30 seconds. This is happening when the client is on my local machine and the service I am making the call is running on a server. Also, client and service is on a server. But when client and service running on my local machine, timeout is working fine. Anyone know what is causing this?

@SpringBootApplication
public class PlaylistPublisher {

    public static void main(String[] args) {
        SpringApplication.run(PlaylistPublisher.class, args);
    }

    @Bean
    public ServletRegistrationBean<DispatcherServlet> dispatcherRegistration(DispatcherServlet dispatcherServlet) {
        return new ServletRegistrationBean<>(dispatcherServlet, "/rest/*");
    }

    @Bean
    public RestTemplate restTemplate() {
        HttpComponentsClientHttpRequestFactory clientHttpRequestFactory = new HttpComponentsClientHttpRequestFactory();
        clientHttpRequestFactory.setReadTimeout(120000);
        return new RestTemplate(clientHttpRequestFactory);
    }

}
@Autowired RestTemplate restTemplate;

    public String getService() {
        UriComponentsBuilder builder = UriComponentsBuilder.fromUriString("https://testservice.net/US/get/2020-05-26T01:00:00.000-0400/2020-05-27T00:00:00.000-0400/QVC/Update/playout");
       return restTemplate.getForObject(
                builder.toUriString(),
                String.class);
    }

Comment From: sbrannen

I've edited your comment to improve the formatting. You might want to check out this Mastering Markdown guide for future reference.

Comment From: rstoyanchev

Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use the issue tracker only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.