Describe the solution you'd like
Complements: https://github.com/spring-cloud/spring-cloud-netflix/issues/4255
Consider implementing RestClientTransportClientFactory to complement existing RestTemplateClientFactory (not exactly based on RestTemplate), which is kind of deprecated.
https://docs.spring.io/spring-framework/reference/integration/rest-clients.html#rest-restclient
See note: https://docs.spring.io/spring-framework/reference/integration/rest-clients.html#rest-resttemplate
Comment From: OlgaMaciaszek
Makes sense.
Comment From: injae-kim
FYI, PR: https://github.com/spring-cloud/spring-cloud-netflix/pull/4281
Comment From: OlgaMaciaszek
Thanks, @injae-kim. @heowc is working on this now.
Comment From: OlgaMaciaszek
Update: there's still some work related to adjusting config in TransportClientFactories, that I'm working on here that has to be modified in order for RestClient to be used as the default.
Comment From: heowc
Update: there's still some work related to adjusting config in TransportClientFactories, that I'm working on here that has to be modified in order for RestClient to be used as the default.
Thanks for looking into it. I think it can be modified with RestClient.Builder
, but I'm curious as to why it needs to be added. 🤔
Comment From: OlgaMaciaszek
We need to integrate with Netflix's native way of handling connections through TransportClientFactories
, otherwise there'll be a TransportException
.
com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112) ~[eureka-client-2.0.4.jar:2.0.4]
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56) ~[eureka-client-2.0.4.jar:2.0.4]
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$1.execute(EurekaHttpClientDecorator.java:59) ~[eureka-client-2.0.4.jar:2.0.4]
at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:76) ~[eureka-client-2.0.4.jar:2.0.4]
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56) ~[eureka-client-2.0.4.jar:2.0.4]
at com.netflix.discovery.DiscoveryClient.register(DiscoveryClient.java:828) ~[eureka-client-2.0.4.jar:2.0.4]
at com.netflix.discovery.InstanceInfoReplicator.run(InstanceInfoReplicator.java:125) ~[eureka-client-2.0.4.jar:2.0.4]
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[na:na]
at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:317) ~[na:na]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) ~[na:na]