From the course: Node.js: Microservices
What's your goal for this chapter? - Node.js Tutorial
From the course: Node.js: Microservices
What's your goal for this chapter?
- [Host] By now we have two applications, the shopper frontend and the catalog service. We know that the catalog service listens on a random part and it can even run on a completely different host or in some container or even in the cloud. The problem is now that the shopper application cannot know where to find the catalog service, neither its IP Address nor its port is known. We would need something like a phone book that contains a list of services and the locations and the so-called service registry is exactly that. We would need something like a phone book that contains a list of all services, and their locations and the so-called service registry is exactly that. Let's see how this works. The service registry is nothing but a service itself. It just listens on a known port. There are other ways to make even this dynamic but from my experience, abstraction needs to end somewhere where things just get too complicated. Now, when a service starts up, it does a rest call to the service registry and registers itself with its name, its IP and its port. The service registry now stores this information. Next, when the shop app now wants to call the catalog service it first asks the service registry for its location. The service registry ideally now returns the location of the catalog service. Now, when the shopper app wants to call the catalog service it'll first ask the service registry for its location. The service registry hopefully then returns this location and with that information we can finally make the call to the catalog service. This is the bare minimum functionality. In this chapter, we will also make sure that services can unregister themselves on shutdown and also will be removed if this suddenly disappear without notice. This is called a timeout. So are you ready? Let's get started.
Contents
-
-
-
-
-
-
What's your goal for this chapter?1m 59s
-
(Locked)
Setting up the registry5m 6s
-
(Locked)
Registering services6m 55s
-
(Locked)
Creating and testing the registration route5m 9s
-
(Locked)
Unregistering services9m 27s
-
(Locked)
Querying the registry8m 23s
-
(Locked)
Removing expired services7m 18s
-
(Locked)
Registering on service on start5m 9s
-
(Locked)
Adding heartbeat and unregistering on shutdown4m 53s
-
-
-
-
-