If the world is a set of entities, no entity is self-sufficient.
I came to Bengaluru in the late 90s. Like any other newcomer, I too was looking for service providers like milk suppliers, electricians and etc., I was sure that those service providers do available in the city. But, where?
Let me repeat: if the world is a set of entities, no entity is self-sufficient. An entity can be a person in the real world, an object in the object-oriented world, or a node in a distributed world, or a service in a microservices world.
Entities often depend on services from other entities. Thus we see service consumers and service providers. The question is this: How does a consumer know about the available providers? or how does a provider makes itself known to the prospective consumers?
We need a directory like Sulekha, Getit Yellowpages, UrbanPro, JustDial, etc., These directories are known as Registries in the patterns jargon. You might have heard about the likes of Service Registry, Naming Registry, JNDI, UDDI, Eureka, and etc.,
The infrastructure of a modern deployment consists of a registry service among other important services.
At the time of deploying a service provider, an entry is made in the registry along with the service description.
The description can be in the form of a simple interface, or in the form of a service name or in the form of a complex WSDL, or in some other form.
The registry is expected to make sure that the registered services are in working condition, time to time. What good it is if a registered service is unreachable?
Who registers the service with the registry? If the service provider registering itself with the registry, it is called the Self-Registration pattern. Instead, if a third party is registering a provider with the registry, it is called the Registrar pattern. They have their own pros and cons.
There can be multiple providers for the same service as is the case in the real world. The service consumers take the help of the registry to find an appropriate provider. This process is often termed Service Discovery. Again, you have client-side discovery and server-side discovery patterns.