I'm using RestClient for upstream communication and would like to add some enhancements to make it more robust. Here's my current setup:
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
factory.setConnectTimeout(300);
factory.setReadTimeout(300);
RestClient restClient = RestClient.builder()
.requestFactory(factory)
.baseUrl("http://...:8080/..")
.build();
Map<String, Object> response = restClient.get()
.uri(backend)
.retrieve()
.body(Map.class);
Regarding Environment:
- JDK21
- org.springframework.boot:3.2.0-M3
- spring.threads.virtual.enabled=true
I'd appreciate suggestions on:
- Integrating a circuit breaker with RestClient.
- Implementing a retry mechanism.
- Configuring the client to use a proxy gateway.
Has anyone done this before or can point me to relevant resources?
Here are the working solution I have.
I wanted to understand if everything operates under the virtual thread paradigm, but this aspect remains ambiguous to me.