RAHUL ROY
RAHUL ROY

Reputation: 136

How to get load balanced access to different microservices ( Using ribbon, Springboot)

Consider a scenario: MasterApp( microservice 1) needs to call AssistApp( Microservice 2) to get data set A and tertiaryApp ( microservice 3) to get data set B. Each `Microservice ( 2 and 3) has 3 instance which needs to be load balanced( Ribbon is getting used for client side load balancing). Can you please let me know How should I prepare application.properties. I cannot put all 6 instance under property list of servers .

I have searched google( Dzone, nginx, spring examples in github and other forums), for a while but I was not able to find a conclusion for this Scenario.

Upvotes: 0

Views: 63

Answers (1)

Chao Jiang
Chao Jiang

Reputation: 493

Generally, you shouldn't config anything in application.properties. I think you already have a param spring.application.name in your application.properties. And also, you have register your application into Eureka.

Then your call should be :

restTemplate.getForObject("http://SERVICE_NAME/xx/yy")

You don't need care about your 3 instance ip/port, just keep them the same application name.

Also, you should consider Feign, it will more convinced for your requirement.

Upvotes: 1

Related Questions