This is the 5th day of my participation in the August More Text Challenge

How to judge a person’s use of Euraka, we need to ask him whether he is clear about its implementation principle. Of course, this cannot completely test his proficiency, but at least he will have a basic understanding.

Then what is the implementation process of Euraka? We all know that the most important function of Euraka is service registration, so the question arises: what is the service registration process or principle of Euraka? Let me explain.

Euraka’s service registration process has several key knowledge as follows, including service registration, service renewal, service elimination, service referral and acquisition of registration information.

Euraka registration process

First about the registration process.

  1. First of all, when the application is started, the system will read the relevant configuration of Euraka, so as to load the relevant information of Euraka configuration, so as to ensure the subsequent registration and use.

  2. It then loads its configuration information, encapsulates it into a Euraka client instance, and sends this instance to the Euraka server.

  3. Then, the registration information of Euraka server is obtained and cached in the local service.

  4. Finally, register your own instance in the Euraka registry.

  5. In fact, the registration process of Euraka has already been completed from the previous step. However, there will still be a renewal after successful registration, because the client and server need to know frequently whether the other side is available. Here comes Euraka’s service renewal function.

  6. The Euraka client also periodically obtains the registration information of the Euraka registry to ensure the consistency between the local registration information and the server. Here is the function to get registration information.

  7. When the Euraka client needs to destroy the current instance, it needs to execute an internal code block to do so within the Euraka registry; This is the service offline function.

  8. In the event that the service provider does not renew the service with the registry for a period of time (90s by default, but you can set it yourself), the registry will remove the service from the service registry. This is service culling.

So much for Euraka’s registration process, let’s explain some of the keywords mentioned so far.

Keyword analysis

The service registry

The Euraka client provides a series of basic information such as IP and port to the Euraka registry to register with the registry.

The service contract

Euraka provides a heartbeat monitoring function. The Euraka client performs a renewal operation with the registry through the regular heartbeat time, which is 30 seconds by default. Euraka also provides relevant configuration items for developers to configure.

Service to eliminate

If there is no renewal operation within 90 seconds, the registry will not save the related information of Euraka client and will carry out a deletion operation. The default time is 90s. Euraka also provides related configuration items for developers to configure.

Service offline

The Euraka client initiates a service offline operation to the registry when the application is shut down, and the registry is notified to remove all its information, but this service offline operation requires the developer to write his own code to invoke it.

Get registration Information

Getting registration information is easier to understand. Each Euraka instance will request the registry when it needs it, and the registry will feedback all the current registration information to the instance.