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

Service Registry pattern

Open npathai opened this issue 9 years ago • 12 comments

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.

npathai avatar Feb 16 '16 09:02 npathai

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

Aravamudhan avatar Mar 01 '16 04:03 Aravamudhan

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

npathai avatar Mar 01 '16 06:03 npathai

@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.

Aravamudhan avatar Mar 01 '16 17:03 Aravamudhan

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

npathai avatar Mar 02 '16 08:03 npathai

@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.

Aravamudhan avatar Mar 02 '16 09:03 Aravamudhan

@Aravamudhan are you still working on this?

iluwatar avatar Jul 14 '16 09:07 iluwatar

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

Aravamudhan avatar Jul 14 '16 13:07 Aravamudhan

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

iluwatar avatar Jul 14 '16 16:07 iluwatar

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/

javatlacati avatar Apr 19 '22 13:04 javatlacati

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

ved-asole avatar Sep 14 '23 04:09 ved-asole

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 Nov 16 '23 16:11 stale[bot]