Skip to content

practical-microservices/spring-cloud-eureka-basics

Repository files navigation

Spring Cloud Netflix - Service Discovery Eureka Basics

Overview

This sample shows off how to use Spring Cloud Eureka for service discovery between microservices. In this sample it will be shown how message-service registers itself inside eureka, while billboard-client is able to resolve the endpoint for message-service from the eureka registry by looking it up by it's service name.

Run the Demo

  • Import the root of the repo into your favorite Java IDE
  • Run eureka-server application
  • Run message-service application
  • Browse to http://localhost:8761 and confirm that message-service is showing up in the eureka registry
  • Run billboard-client application and browse it to it in your browser

Things to try out

  • Examine BillboardController in billboard-client to view how the invocation URL is based on application name instead of actual endpoint. The hostname will be automatically substituted by Eureka
  • Browse to eureka dashboard at http://localhost:8761. Observe that only the message-service is showing up, as billboard-client only fetches registry, but doesn't advertise itself
  • Run multiple instances of message-service. Observe how a single service have multiple instance URLs in eureka dashboard. The calling application will do client-side load balancing by selecting a random instance when calling it.

Resources to Learn More:

About

Demo's Showing the Basics of Working with Spring Cloud Eureka

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published