spring-cloud / spring-cloud-netflix

Integration with Netflix OSS components

Home Page:http://cloud.spring.io/spring-cloud-netflix/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't enable RibbonClientHttpRequestFactory by default

spencergibb opened this issue · comments

This should be opt-in as Ribbon's RestClient is deprecated.

One last thought on this: Isn't the use of RibbonClientHttpRequestFactory already an opt-in because you must annotate your rest template bean with @LoadBalanced? It seems redundant to also have to opt-in with an environment property as well.

What is the behavior when the property ribbon.http.client.enabled is false but a RestTemplate has been annotated with @LoadBalanced? Is there a plan to use an alternate request factory that uses some other mechanism for load balancing?

@tkvangorder The commons LoadBalancerInterceptor kicks in. It uses the standard spring wired http client. RibbonClientHttpRequestFactory was mostly a request from Netflix. When I met with them last week, we decided it should be opt in.

Gotcha, makes sense.

Is there any ClientHttpRequestFactory provided by default to use with restTemplate for service discovery (use of http://serviceId/something) instead of RibbonClientHttpRequestFactory?

@vajda Could you please clarify the question? RibbonClientHttpRequestFactory is what provides the functionality that allows you to use client names (e.g. serviceId) in your requests. Are you looking for a non-Ribbon alternative?

@vajda & @jkschneider We have two implementations:

  1. The commons LoadBalancerInterceptor just reconstructs the url and lets vanilla spring handle the http connection. This is the default. It is not a ClientHttpRequestFactory but a request interceptor.
  2. The spring cloud netflix RibbonClientHttpRequestFactory which uses the netflix ribbon client to for http. This is not enabled by default. You must use ribbon.http.client.enabled=true to use it. This is the only ClientHttpRequestFactory we have.

@spencergibb @jkschneider

A question I have: Since the Netflix ribbon http client has been deprecated and the code hints at using the Netflix Netty client instead, are there any plans to add a RibbonNettyClientHttpRequestFactory when using the AsyncRestTemplate?

From what I understand, they don't use it either:

What I can see happening is a reactive http client coming in Spring 5 via Boot 2 that we would integrate with.

Makes sense, thanks for the clarification.

@spencergibb Thanks for clarification.