java-design-patterns icon indicating copy to clipboard operation
java-design-patterns copied to clipboard

Microservice pattern: Client-side service discovery

Open iluwatar opened this issue 2 years ago • 11 comments

Description: The Client-Side Service Discovery pattern is a design strategy in microservice architectures where the client is responsible for determining the network location of service instances. This involves querying a service registry, which keeps track of available service instances. The client retrieves the required information and selects an appropriate service instance to communicate with.

Main elements of the pattern include:

  • Service Registry: A centralized database that maintains the addresses of service instances.
  • Service Registration: Services register their network locations (IP addresses and port numbers) with the service registry.
  • Service Querying: Clients query the service registry to get the location of a service instance.
  • Load Balancing: Clients implement load balancing strategies to choose among multiple service instances.

References:

  1. Microservices Patterns
  2. Spring Cloud Netflix Eureka
  3. Project Contribution Guidelines

Acceptance Criteria:

  1. Implement a service registry that can register and deregister service instances.
  2. Create a client module that can query the service registry to discover service instances.
  3. Ensure that the client module includes a basic load-balancing mechanism to distribute requests among multiple service instances.

iluwatar avatar Oct 15 '23 17:10 iluwatar

hello am from MLHhackathon open soucre week. can you assign me this

lokytech5 avatar Oct 16 '23 19:10 lokytech5

thanks for this, am jumping on it right away

lokytech5 avatar Oct 17 '23 21:10 lokytech5

I want to ask if can i use Spring Boot to implement the pattern as specified in the documentation just to be sure am on track. thanks

lokytech5 avatar Oct 18 '23 03:10 lokytech5

Yes, Spring Boot is perfectly fine. It has been used in some of the other patterns as well.

iluwatar avatar Oct 22 '23 13:10 iluwatar

Hello, I just completed the task assigned to me. How do you suggest I create a PR because each microservices has its own folder? e.g. service-registry has its own folder directory, likewise the rest of the microservices I created. I was thinking if I could add all the microservice folders in a single folder, initialize git, and add a readme.Md file along with it and create a PR. I don't know if this suggestion is okay. please let me know which to follow. thanks

lokytech5 avatar Oct 22 '23 21:10 lokytech5

I think we could follow the approach taken in aggregator-microservices, see https://github.com/iluwatar/java-design-patterns/tree/master/aggregator-microservices

iluwatar avatar Oct 25 '23 17:10 iluwatar

Good day, @iluwatar. I hope you are doing well. Is there any article or guide I can follow on configuring the microservice parent pom.xml since I am following a similar pattern?[https://github.com/iluwatar/java-design-patterns/tree/master/aggregator-microservices]. I could configure it but could not run it on my laptop. thanks

lokytech5 avatar Oct 26 '23 17:10 lokytech5

This issue has been automatically marked as stale because it has not had recent activity. The issue will be unassigned if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 26 '23 15:12 stale[bot]