Services that exit gracefully should be able to unregister themselves. In this video, learn how to build that functionality into the registry.
- [Instructor] Later services … will register and unregister themselves. … But there may be cases when a service … shuts down non gracefully with no chance to unregister. … Lets make the rule … that services need to send a heartbeat … to reregister themselves, continuously. … Data service that we haven't seen for 30 seconds … is considered to be expired. … So, if we look at service registry, … just if you remember, … in register, … we already have this function that updates the timestamp … if the service was already registered. … Now we will add a new function that we call cleanup. … And in cleanup, we first get current timestamp. … So const now = math.floor. … New date divided by 1000. … And then I run through the services with object keys. … This.services … and I do a for each on them … and I get a key in my callback. … And in there, … I am trying to find out if the service is expired. … Add if this services key .timestamp + this.timeout … is lower than now, … we will delete this services key. …
- Setting up a service registry
- Registering and deregistering services
- Versioning and load balancing
- Adding the service logic
- Working with the circuit breaker
- Using queues
- Consuming and storing feedback
Skill Level Intermediate
Node.js: Debugging and Performance Tuningwith Jon Peck2h 44m Intermediate
1. Get started with Microservices
2. Creating a Service Registry
3. Splitting Up a Monolith into Microservices
4. Adding Fault Tolerance and Resilience
5. Using Queues with Node.js
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.