iluwatar / java-design-patterns

Design patterns implemented in Java
https://java-design-patterns.com
Other
88.28k stars 26.19k forks source link

Service Registry pattern #383

Open npathai opened 8 years ago

npathai commented 8 years ago

Description

The Service Registry design pattern is a central service registry that maintains a database of available services. It acts as a lookup mechanism, allowing services to register themselves and clients to discover services. This pattern is crucial for service-oriented architectures (SOA) and microservices, facilitating dynamic discovery and decoupling of service consumers and providers.

Main Elements of the Pattern

  1. Service Registry: A central database that holds the details of available services, such as their network locations and interfaces.
  2. Service Provider: Registers its service with the service registry, providing metadata such as the service name, version, and network address.
  3. Service Consumer: Queries the service registry to find services and obtain their metadata for consumption.
  4. Heartbeat Mechanism: Ensures that the service registry has up-to-date information about the service availability through periodic heartbeat messages from the service providers.

References

Acceptance Criteria

  1. Implement a basic service registry that can register services and allow querying for service details.
  2. Include a heartbeat mechanism for service providers to periodically update their status in the registry.
  3. Provide example implementations of a service provider registering itself and a service consumer querying the registry.
Aravamudhan commented 8 years ago

@npathai @iluwatar I am working on this pattern. Please add under construction tag to this issue. Thanks.

npathai commented 8 years ago

@Aravamudhan Sure. I would suggest you to discuss the approach. We may need some microservice toolkit for this.

Aravamudhan commented 8 years ago

@npathai We can use Spring boot. I deployed the app in my machine. It worked quite well. Please let me know if that is fine.

npathai commented 8 years ago

@Aravamudhan Yes that would be fine :+1: I haven't used Sprint Boot personally though.

Aravamudhan commented 8 years ago

@npathai Even I never used it before. Recently came across it. It makes creating apps and deploying them extremely simple. Since in this pattern we need to deploy few apps, by using Spring boot, we do not even need a server or db connection for deploying the applications we create.

iluwatar commented 7 years ago

@Aravamudhan are you still working on this?

Aravamudhan commented 7 years ago

@iluwatar I apologize for not informing before. No I am not currently working on this pattern.

iluwatar commented 7 years ago

It's ok. I'll change the labels to indicate this issue is free for taking again.

javatlacati commented 2 years ago

I knew this as Service Discovery, and the service registry as a part of it. https://www.nginx.com/blog/service-discovery-in-a-microservices-architecture/

ved-asole commented 9 months ago

HI @iluwatar, please let me know if I can work on the above PR. I would like to contribute here.

stale[bot] commented 7 months ago

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.