Next Step in Microservices

After following the microservices style of software development, there arises the need for certain additional components to be developed. As we have seen how single web application was broken down into smaller pieces (services). With new requirements that may come up in the future, the number of services catering to our web application would increase. With increasing microservices being developed as per this model of software development, there came the need for a central location to track these services.

In this way, it would be easier to identify which of the services are currently up and running and which of the services have failed to start on the application run time.

Prerequisites to the Topic:

  • Project: Maven
  • Language: Java
  • Java Version: 11
  • Packaging: Java Archive
  • IDE: Eclipse (with Spring Tool Suite installed)
  • Configuring the Eureka Server

In our example, we shall set up a Eureka Server along with 2 sample services that would register themselves with the Eureka Server for the purpose of the service discovery mechanism. The 2 sample services would be a Cart Service and a User Service. The user places the request for a specific item_id by invoking the User Service’s endpoint and then it calls the Cart Service which will place a request for that item_id in the inventory.

To create these services, we shall use the Spring Starter Project utility, provided by the Eclipse IDE.

Implementation of Spring Cloud Netflix – Eureka

In this article, we will learn about server-side and client-side service discovery in Spring Cloud Netflix Eureka. By using the central registry service, we can discover all of the microservices that are catering to our web application along with the respective port numbers they have occupied on startup. This central registry service is what is termed as Spring Cloud Netflix Eureka Server. This Eureka server fulfills the sole purpose of service discovery. Each of the microservices that register themselves with the Eureka server sends their respective status updates at regular intervals of time to the Eureka server.

In this way, the Eureka server is continuously updated about the status of each service (whether the service is up and running). It also keeps track of the number of requests being handled by each instance of those respective services, which plays an important role in the load-balancing aspect of microservices.

Similar Reads

Next Step in Microservices

After following the microservices style of software development, there arises the need for certain additional components to be developed. As we have seen how single web application was broken down into smaller pieces (services). With new requirements that may come up in the future, the number of services catering to our web application would increase. With increasing microservices being developed as per this model of software development, there came the need for a central location to track these services....

Creating the Eureka Server

Create the Eureka Server Spring Boot Project in Eclipse IDE by going to,File -> New -> Spring Starter Project...

Creating the User Service

In the Eclipse IDE, go to File -> New -> Spring Starter Project . This will open the Spring Starter Project dialogue box below....

Creating the Cart Service Project

In the Eclipse IDE, go to File -> New -> Spring Starter Project . This will open the Spring Starter Project dialogue box below....

Conclusion

...