- Mastering Spring Cloud
- Piotr Minkowski
- 156字
- 2021-08-27 18:57:00
Service discovery with Eureka
The first pattern provided by Spring Cloud Netflix is the service discovery with Eureka. This package is divided into client and server.
To include a Eureka Client in your project you should use the spring-cloud-starter-eureka starter. The client is always a part of an application and is responsible for connecting to a remote discovery server. Once the connection is established it should send a registration message with a service name and network location. In case the current microservice has to call an endpoint from another microservice, the client should retrieve the newest configuration with a list of registered services from the server. The server can be configured and run as an independent Spring Boot application and it is supposed to be highly available with each server replicating its state to other nodes. To include a Eureka Server in your project you need to use the spring-cloud-starter-eureka-server starter.