Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

337
Visualizações
Netflix Ribbon with Spring Adding Multiple Clients

My application connects with multiple REST APIs.

I've been successful in adding a Ribbon Client/Load Balance to my application for one of those APIs with its own list of servers

Now I'd like to add a second client that would hold the server list for my second API.

In order to define my client name which is used by Archaius to load specific properties, I added the following property.

ribbon.client.name=myFirstClientName

My question is: How do I define another client on the same application?

I thought it would be a comma-separated list like:

ribbon.client.name=myFirstClientName,mySecondClientName

However, this didn't work.

Eventually, I want to end up with two lists of servers like

myFirstClientName.ribbon.listOfServers=<ip>,<ip>
mySecondClientName.ribbon.listOfServers=<ip>,<ip>

Any thoughts?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I was able to make it work by adding a @RibbonClient annotation on the interfaces I created for Feign.

The resulting class would be

@FeignClient("http://myFirstClientName/")
@RibbonClient(value = "myFirstClientName", configuration = MyFirstClientConfig.class)
public interface MyFirstFeignService {

Second Client would be:

@FeignClient("http://mySecondClientName/")
@RibbonClient(value = "mySecondClientName", configuration = MySecondClientConfig.class)
public interface MySecondFeignService {

Then of course I would set my two lists of server ips

myFirstClientName.ribbon.listOfServers=<ip>,<ip>
mySecondClientName.ribbon.listOfServers=<ip>,<ip>

PS: Make sure your config classes - MySecondClientConfig and MyFirstClientConfig - above are NOT on the ApplicationContext. Don't let it be caught by some @ComponentScan somewhere or else it won't work.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda