22- Service Registry and Eureka Service
Service Registry and Eureka Service
Up until now we have created our first springboot project that has 2 microservices communicating and working together.
And in Service Layer of user-service we have written the url for microservices directly in restTemplate.getForObject function.
But when we have more microservices working together then writing the url directly and configuring them in resources folder will become quite difficult to manage and keep track.
Basically what we will do instead writing the url directly(http://localhost:8080/users) we will put a variable(DEPARTMENT-SERVICE) and assign the required value of url to it.
Now when we have to change url we will change only in variable and the value changes happen wherever variable is present.
This variable is managed and microservices tracked by service registry. This is where Service Registry and Eureka Server comes into play.
Image 1 - Service Registry
What is Service Discovery?
--> Service Discovery:
Microservices service discovery is a way for applications and microservices to locate each other on a network. Service discovery implementations within microservices architecture discovery includes both:
• a central server (or servers) that maintain a global view of addresses.
• clients that connect to the central server to update and retrieve addresses.
OR
In simple terms all the URLs or addresses of microservices are tracked by Service Discovery.
Comments
Post a Comment