Routing method and device of component, electronic equipment and readable storage medium
By introducing a route initiator into the microservice architecture, a unified path is used to receive and forward service requests, which solves the problem of excessive system resource consumption caused by too many routing ports and simplifies the operation and maintenance process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHONGQING SAISHENG INTELLIGENT TECH RES INST CO LTD
- Filing Date
- 2023-03-14
- Publication Date
- 2026-06-16
AI Technical Summary
In a microservice architecture, as the number of services increases, too many routing ports lead to excessive system resource consumption, increasing the difficulty of operation and maintenance.
A route initiator is introduced to receive service requests through a unified path route port and perform route forwarding in the registration and discovery components, avoiding the need to set up a separate route port for each service.
It implements a unified routing port routing strategy in a microservice architecture, reducing system resource consumption and simplifying operation and maintenance.
Smart Images

Figure CN116418875B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and more specifically, to a method, apparatus, electronic device, and readable storage medium for routing components. Background Technology
[0002] Increasingly complex business operations and ever-growing architectures have presented significant challenges to R&D teams. In this context, microservice architecture emerged with a specific purpose: to address these challenges. Microservice architecture is a system of registered and discovered components.
[0003] Microservice architecture can be considered an extension of Service-Oriented Architecture (SOA). This architectural pattern features finer-grained decomposition and more independent services. The application is broken down into small, independent services, each using different programming languages and storage methods. These services often communicate with each other using lightweight methods like RESTful. The key to microservice architecture lies in its small size, independence, and lightweight communication.
[0004] Microservices are a more granular advancement on SOA, emphasizing a key principle of "thorough componentization and service-orientation of business logic." Within the vast Spring Cloud component family, addressing service registration, discovery, and load balancing is paramount, as they serve as the entry point for service instances.
[0005] However, the detailed business and functional decomposition increased the difficulty of later-stage operation and maintenance. In existing technologies, the more independent services there are in a microservice, the more routing ports need to be provided, resulting in redundant microservices and excessive consumption of system resources. Summary of the Invention
[0006] The embodiments of this application provide a component routing method, apparatus, electronic device, and readable storage medium. The component routing method can unify the routing path, receive service requests through the unified routing path, and forward the service requests. This avoids the problem in related technologies where a routing port is set for each service, resulting in too many routing ports, which leads to microservice redundancy and excessive consumption of system resources.
[0007] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0008] According to one aspect of the embodiments of this application, a routing method for a component is provided, the method comprising: introducing a routing initiator in a registration and discovery component, the routing initiator being used to initiate a routing port of a unified path; writing a configuration file for the routing initiator, and migrating the configuration corresponding to the routing initiator to the registration and discovery component through the configuration file; receiving service requests through the routing port of the unified path, and routing and forwarding the received service requests according to the configured registration and discovery component.
[0009] In some examples of this embodiment, a route initiator is introduced into the registration and discovery component, including: obtaining the dependency corresponding to the route initiator and determining the reading method corresponding to the registration and discovery component; making the dependency into the route initiator based on the determined reading method, and introducing the route initiator into the registration and discovery component.
[0010] In some examples of this embodiment, a configuration file for the route initiator is written, and the configuration corresponding to the route initiator is migrated to the registration and discovery component through the configuration file. This includes: writing the configuration file for the route initiator; defining a routing interface in the registration and discovery component; and accessing the configuration file through the routing interface to migrate the configuration corresponding to the route initiator to the registration and discovery component.
[0011] In some examples of this embodiment, the method further includes: providing a visual interface, receiving control commands input by an object based on the visual interface; and setting based on the control commands.
[0012] In some examples of this embodiment, receiving service requests through a unified path routing port and routing the received service requests according to the configured registration and discovery components includes: receiving the service request through the unified path routing port of the registration and discovery components; reading the list of registered services from the registration and discovery components and finding the service corresponding to the service request; and forwarding the service request to the corresponding service according to the path corresponding to the service request.
[0013] In some examples of this embodiment, if there are multiple service requests, the received service requests are routed and forwarded according to the configured registration and discovery components, including: if the number of service requests is less than a preset threshold, the ports corresponding to the service requests are modified to the routing ports of a unified path, and each service request is forwarded to the corresponding service through the routing of the unified path; if the number of service requests is greater than the preset threshold, the current load of the routing ports of the unified path is obtained, and the multiple service requests are divided according to the current load, and the service requests are forwarded to the corresponding services according to the division results.
[0014] According to one aspect of the embodiments of this application, this application provides a routing apparatus for components, the apparatus comprising: an introduction module, the introduction module being configured to introduce a route initiator into a registration and discovery component, the route initiator being configured to initiate routing for a unified path; a configuration module, the configuration module being configured to write a configuration file for the route initiator, and to migrate the configuration corresponding to the route initiator to the registration and discovery component through the configuration file; and a routing module, the routing module being configured to receive service requests and to route and forward the received service requests according to the configured registration and discovery component.
[0015] In some examples of this embodiment, the import module is further configured to obtain the dependencies corresponding to the route initiator and determine the reading method corresponding to the registration and discovery components; based on the determined reading method, the dependencies are made into the route initiator, and the route initiator is imported into the registration and discovery components.
[0016] According to one aspect of the embodiments of this application, an electronic device is provided, including one or more processors; and a storage device for storing one or more computer programs, which, when executed by the one or more processors, cause the electronic device to perform the method as described above.
[0017] According to one aspect of the embodiments of this application, an embodiment of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor of an electronic device, causes the electronic device to perform the method described above.
[0018] This example provides a component routing method that includes: introducing a route initiator into the registration and discovery component, the route initiator being used to activate a unified path routing port; writing a configuration file for the route initiator, and migrating the configuration corresponding to the route initiator to the registration and discovery component through the configuration file; receiving service requests through the unified path routing port, and routing and forwarding the received service requests according to the configured registration and discovery component. This component routing method, by setting a routing port for activating the unified path and receiving service requests through a unified routing path, and then routing and forwarding the service requests, implements a unified routing port routing strategy in the registration and discovery component. This avoids the problem in related technologies where a separate routing port is set for each service, resulting in too many routing ports, leading to redundancy in the registration and discovery component and excessive consumption of system resources.
[0019] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0020] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0021] Figure 1 This is a basic flowchart of the routing method for the components provided in this embodiment;
[0022] Figure 2 A schematic diagram of the basic structure of the routing device for the components provided in this embodiment;
[0023] Figure 3 This is a schematic diagram of the computer system of the electronic device provided in this embodiment. Detailed Implementation
[0024] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0025] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0026] The flowcharts shown in the accompanying diagrams are merely illustrative and do not necessarily include all content and operations, nor do they necessarily have to be executed in the described order. For example, some operations may be broken down, while others may be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0027] It should also be noted that "multiple" as mentioned in this application refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0028] Example 1
[0029] To address the aforementioned technical problems, embodiments of this application provide a component routing method, such as... Figure 1 As shown, the method includes:
[0030] S101. Introduce a route initiator in the registration and discovery component, the route initiator being used to start the routing port of the unified path;
[0031] S102. Write a configuration file for the route initiator, and migrate the configuration corresponding to the route initiator to the registration and discovery component through the configuration file;
[0032] S103. Receive service requests through the routing port of the unified path, and route and forward the received service requests according to the configured registration and discovery components.
[0033] It is understandable that the aforementioned registration and discovery component is a dynamic service discovery, configuration management, and service management platform that is easy to build native applications with. That is, the registration and discovery component includes a registry center and a configuration center. This component enables service registration, service discovery, and load balancing. Specifically, service registration involves service providers registering / declaring their service information (server IP and port, service access protocol, etc.) to the registry center; service discovery allows service consumers to obtain a relatively real-time list of services from the registry center and then select a service to access based on certain strategies; and load balancing distributes request pressure across multiple servers (application servers, database servers, etc.) to improve service performance and reliability.
[0034] It is understood that this embodiment does not limit the types of components used for registration and discovery. For example, the components used for registration and discovery may be Nacos.
[0035] It is understood that the routing method of the above components is applied to servers with registration and discovery components. This example does not limit the number of unified ports. For example, one unified port can be set in the registration and discovery component; or multiple unified ports can be set in the registration and discovery component.
[0036] In some examples of this embodiment, a route launcher is introduced into the registration and discovery component, including: obtaining the dependencies corresponding to the route launcher and determining the reading method corresponding to the registration and discovery component; creating the route launcher from the dependencies based on the determined reading method, and introducing the route launcher into the registration and discovery component. The dependencies corresponding to the route launcher include framework integration scenarios. By determining the reading method corresponding to the registration and discovery component and creating the route launcher from the dependencies based on the determined reading method, the registration and discovery component can read the route launcher.
[0037] Continuing with the previous example, taking Nacos as the component for registration and discovery, we obtain the dependencies corresponding to the route initiator and determine the reading method corresponding to Nacos. Based on the determined reading method, we create the route initiator from the dependencies and import the route initiator into the pom file of Nacos, thereby importing the dependencies into Nacos.
[0038] In some examples of this embodiment, a configuration file for the route initiator is written, and the configuration corresponding to the route initiator is migrated to the registration and discovery component through the configuration file. This includes: writing the configuration file for the route initiator; defining a routing interface in the registration and discovery component; and accessing the configuration file through the routing interface to migrate the configuration corresponding to the route initiator to the registration and discovery component. The configuration file for the route initiator includes, but is not limited to: ID, service name registered in the registry, keywords, assertions, matching rules, etc. After writing the configuration file, a routing interface is defined in the registration and discovery component, and the configuration file is accessed through the routing interface to migrate the configuration corresponding to the route initiator to the registration and discovery component.
[0039] Continuing from the previous example, taking Nacos as the registration and discovery component, we will write the configuration for the route initiator into a yml format configuration file, and define the routing interface inside Nacos to implement the functionality.
[0040] In some examples of this embodiment, the method further includes: providing a visual interface, receiving control commands input by an object based on the visual interface; and performing service management based on the control commands. It is understood that the service provider registers / registers the information of the services it provides (server IP and port, service access protocol, etc.) with the registration center, and relevant administrators can view the information of the services provided by the service provider through the visual interface, and add, delete, query and modify the services provided by the service provider.
[0041] In some examples of this embodiment, receiving a service request involves receiving the service request through a unified path routing port, and routing the received service request according to the configured registration and discovery component. This includes: receiving the service request through the unified path routing port of the registration and discovery component; reading the list of registered services from the registration and discovery component and finding the service corresponding to the service request; and forwarding the service request to the corresponding service according to the path corresponding to the service request. Here, receiving all service requests through the unified path routing port of the registration and discovery component avoids setting up a separate routing port for each service. When a service request is received through the unified path routing port, the registration and discovery component reads the list of registered services to find the service corresponding to the service request; and forwards the service request to the corresponding service according to the path corresponding to the service request, thus implementing routing within the registration and discovery component.
[0042] In some examples of this embodiment, if there are multiple service requests, the received service requests are routed and forwarded according to the configured registration and discovery components, including: if the number of service requests is less than a preset threshold, the ports corresponding to the service requests are modified to the ports of the unified path route, and each service request is forwarded to the corresponding service through the unified path route; if the number of service requests is greater than the preset threshold, the current load of the unified path route is obtained, and the multiple service requests are prioritized according to the current load, and the service requests are forwarded to the corresponding service according to the prioritization result. Specifically, the registration and discovery component can receive service requests from multiple consumers. When the number of service requests is less than a preset threshold, the registration and discovery component can route each service request to the corresponding service request. If the registration and discovery component receives too many service requests at a certain moment, routing all service requests simultaneously may cause the registration and discovery component to lag, and in severe cases, it may even cause the registration and discovery component to crash. Therefore, to avoid this situation, if the number of service requests exceeds the preset threshold, the current load of the routing port of the unified path is obtained, and multiple service requests are prioritized according to the current load. Based on the prioritization result, the service requests are forwarded to the corresponding services, thereby avoiding the situation where too many service requests are routed and forwarded at the same time, which could cause the registration and discovery component to lag or crash.
[0043] This example provides a component routing method that includes: introducing a route initiator into the registration and discovery component, the route initiator being used to activate a unified path routing port; writing a configuration file for the route initiator, and migrating the configuration corresponding to the route initiator to the registration and discovery component through the configuration file; receiving service requests through the unified path routing port, and routing and forwarding the received service requests according to the configured registration and discovery component. This component routing method, by setting a routing port for activating the unified path and receiving service requests through a unified routing path, and then routing and forwarding the service requests, implements a unified routing port routing strategy in the registration and discovery component. This avoids the problem in related technologies where a separate routing port is set for each service, resulting in too many routing ports, leading to redundancy in the registration and discovery component and excessive consumption of system resources.
[0044] Example 2
[0045] Based on the same concept, this embodiment also provides a routing device for a component, such as... Figure 2 As shown, the device includes:
[0046] Introduction module 1 is used to introduce a route initiator into the registration and discovery components. The route initiator is used to start the routing port of the unified path.
[0047] Configuration module 2 is used to write configuration files for the route initiator and migrate the configuration corresponding to the route initiator to the registration and discovery components through the configuration files;
[0048] The routing module 3 is used to receive service requests through the routing port of the unified path, and to route and forward the received service requests according to the configured registration and discovery components.
[0049] In some examples of this embodiment, the import module 1 is further configured to obtain the dependencies corresponding to the route initiator and determine the reading method corresponding to the registration and discovery component; based on the determined reading method, the dependencies are made into the route initiator, and the route initiator is imported into the registration and discovery component.
[0050] In some examples of this embodiment, a configuration file for the route initiator is written, and the configuration corresponding to the route initiator is migrated to the registration and discovery component through the configuration file. This includes: writing the configuration file for the route initiator; defining a routing interface in the registration and discovery component; and accessing the configuration file through the routing interface to migrate the configuration corresponding to the route initiator to the registration and discovery component.
[0051] In some examples of this embodiment, the method further includes: providing a visual interface, receiving control commands input by an object based on the visual interface; and setting based on the control commands.
[0052] In some examples of this embodiment, receiving service requests through a unified path routing port and routing the received service requests according to the configured registration and discovery components includes: receiving the service request through the unified path routing port of the registration and discovery components; reading the list of registered services from the registration and discovery components and finding the service corresponding to the service request; and forwarding the service request to the corresponding service according to the path corresponding to the service request.
[0053] In some examples of this embodiment, if there are multiple service requests, the received service requests are routed and forwarded according to the configured registration and discovery components, including: if the number of service requests is less than a preset threshold, the ports corresponding to the service requests are modified to the routing ports of a unified path, and each service request is forwarded to the corresponding service through the routing of the unified path; if the number of service requests is greater than the preset threshold, the current load of the routing ports of the unified path is obtained, and the multiple service requests are divided according to the current load, and the service requests are forwarded to the corresponding services according to the division results.
[0054] It is understood that the various modules of the routing device of the component provided in this embodiment can be combined to implement the various steps of the routing method of the above-mentioned component, and achieve the same technical effect as the various steps of the routing method of the above-mentioned component, which will not be elaborated here.
[0055] Example 3
[0056] To better understand the present invention, this embodiment provides a more specific example for illustration;
[0057] This example provides a routing method for a component called Nacos. Specifically, Nacos not only provides service registration and discovery functionality but also configuration management capabilities and a visual management platform. As a service registry, Nacos's functionality is very similar to other mainstream frameworks, primarily revolving around three core functions: service instance registration, instance health checks, and service instance acquisition.
[0058] Nacos' core API defines two interfaces: NamingService and ConfigService. Service registration and discovery revolve around NamingService, while configuration management revolves around ConfigService.
[0059] Through technical modifications, configuration that previously required Gateway can now be done directly in the upgraded Nacos.
[0060] Step 1: Add the corresponding dependency to the pom file of the upgraded Nacos project.
[0061] Understandably, Spring Boot extracts most framework integration scenarios and presents them as starters. By simply importing these starters into the project, all the necessary dependencies for integration are imported. Clearly, we've made Gateway-related route discovery a starter that can be read by the Nacos project. This reading method involves importing it through configuration in the pom file.
[0062] Step 2: Write a yml configuration file, optimize the configuration options that the original Gateway required, and implement the functionality through the newly defined gateNacosWay interface.
[0063] It's understandable that Spring Boot provides corresponding configuration properties after importing the corresponding starter. The .yml file manages the configuration data. The configuration for Gateway-related functions will be migrated to this.
[0064] Step 3: Start the upgraded Nacos
[0065] Through the above two steps, the functionality is integrated into one place. After installation and startup, accessing http: / / localhost:8848 / nacos / will display the locally started service registered with Nacos in this list. At this point, this service can not only perform service instance registration, instance health checks, and service instance acquisition.
[0066] Furthermore, it allows for unified configuration of a single port to redirect responses from multiple services. Through assertions and filtering mechanisms, it ensures correct access to the responding service interfaces.
[0067] The biggest advantage of this approach is that it simplifies development configuration and operational efficiency. It abstracts away complex logic, allowing clients to simply send requests to the upgraded Nacos, which has built-in load balancing functionality. This eliminates the need to implement service discovery logic for clients of every programming language and framework, and also eliminates the need for a dedicated environment for the load balancer. Both functionalities are integrated into a single highly available system component.
[0068] In microservice applications, the running state of service instances changes dynamically, and addresses are dynamically assigned. Therefore, service discovery mechanisms are essential to ensure clients can request services correctly. Furthermore, in multi-service scenarios, unifying the port to a routing port before forwarding requests to individual services is crucial. Some deployment environments (such as Kubernetes and Marathon) run a proxy on each host in the cluster. This proxy acts as a server-side discovery load balancer. When a client makes a request to a service, it is routed through the proxy, transparently forwarding the request to a specific service instance in the cluster. Regardless of the approach, each instance needs to be deployed and configured separately.
[0069] Embodiments of this application also provide an electronic device including one or more processors and a storage device, wherein the storage device is used to store one or more computer programs that, when executed by one or more processors, cause the electronic device to perform the method described in any of the preceding embodiments.
[0070] Figure 3 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown.
[0071] It should be noted that, Figure 3 The computer system 1800 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0072] like Figure 3 As shown, the computer system 1800 includes a central processing unit (CPU) 1801, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, based on a program stored in read-only memory (ROM) 1802 or a program loaded from storage portion 1808 into random access memory (RAM) 1803. The RAM 1803 also stores various programs and data required for system operation. The CPU 1801, ROM 1802, and RAM 1803 are interconnected via a bus 1804. An input / output (I / O) interface 1805 is also connected to the bus 1804.
[0073] In some embodiments, the following components are connected to the I / O interface 1805: an input section 1806 including a keyboard, mouse, etc.; an output section 1807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1808 including a hard disk, etc.; and a communication section 1809 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 1809 performs communication processing via a network such as the Internet. A drive 1810 is also connected to the I / O interface 1805 as needed. A removable medium 1811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 1810 as needed so that computer programs read from it can be installed into the storage section 1808 as needed.
[0074] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1809, and / or installed from removable medium 1811. When the computer program is executed by processor (CPU) 1801, it performs various functions defined in the system of this application.
[0075] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory, flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0076] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and a computer program.
[0077] The units or modules described in the embodiments of this application can be implemented in software or hardware, and can also be located in a processor. The names of these units or modules do not necessarily limit the specific unit or module itself.
[0078] Another aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the methods described in any of the preceding embodiments. This computer-readable storage medium may be included in the electronic device described in the above embodiments, or it may exist independently and not assembled into the electronic device.
[0079] Another aspect of this application provides a computer program product comprising a computer program stored in a computer-readable storage medium. A processor of an electronic device reads the computer program from the computer-readable storage medium and executes the computer program, causing the electronic device to perform the methods described in any of the foregoing embodiments provided in the various embodiments above.
[0080] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0081] Other embodiments of this application will readily conceive of by considering the specification and practicing the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0082] The above content is merely a preferred exemplary embodiment of this application and is not intended to limit the implementation of this application. Those skilled in the art can easily make corresponding modifications or alterations based on the main concept and spirit of this application. Therefore, the scope of protection of this application should be determined by the scope of protection claimed in the claims.
Claims
1. A routing method for a component, characterized in that, The method includes: Introducing a route launcher into the registration and discovery component includes: obtaining the dependencies corresponding to the route launcher and determining the reading method corresponding to the registration and discovery component; creating the route launcher from the dependencies based on the determined reading method and introducing the route launcher into the registration and discovery component, wherein the route launcher is used to start the routing port of the unified path, and the dependencies corresponding to the route launcher include framework integration scenarios. By determining the reading method corresponding to the registration and discovery component and creating the route launcher from the dependencies based on the determined reading method, the registration and discovery component can read the route launcher. Write a configuration file for the route initiator, and use the configuration file to migrate the configuration corresponding to the route initiator to the registration and discovery component; Service requests are received through a unified path routing port, and the received service requests are routed and forwarded according to the configured registration and discovery components.
2. The method according to claim 1, characterized in that, Write a configuration file for the route initiator, and migrate the configuration corresponding to the route initiator to the registration and discovery component through the configuration file, including: Write the configuration file for the route initiator; Define a routing interface in the registration and discovery components; The configuration file is accessed through the routing interface to migrate the configuration corresponding to the routing initiator to the registration and discovery component.
3. The method according to claim 1, characterized in that, The method further includes: A visual interface is provided, based on which control commands input by an object are received; Service management is performed based on the control commands.
4. The method according to claim 1, characterized in that, Service requests are received through a unified path routing port, and the received service requests are routed and forwarded according to the configured registration and discovery components, including: The service request is received through the routing port of the unified path of the registration and discovery components; Read the list of registered services from the registration and discovery component, and find the service corresponding to the service request; Based on the path corresponding to the service request, the service request is forwarded to the corresponding service.
5. The method according to claim 1, characterized in that, If there are multiple service requests; the received service requests are routed and forwarded according to the configured registration and discovery components, including: If the number of service requests is less than a preset threshold, the ports corresponding to the service requests are changed to the routing ports of the unified path, and each service request is forwarded to the corresponding service through the routing of the unified path. If the number of service requests exceeds a preset threshold, obtain the current load of the routing port of the unified path, prioritize the multiple service requests based on the current load, and forward the service requests to the corresponding services according to the prioritization result.
6. A routing device for a component, characterized in that, The device includes: An import module is used to import a route launcher into the registration and discovery components: it obtains the dependencies corresponding to the route launcher and determines the reading method corresponding to the registration and discovery components; based on the determined reading method, it creates the route launcher from the dependencies and imports the route launcher into the registration and discovery components. The route launcher is used to start the routing port of a unified path, and the dependencies corresponding to the route launcher include framework integration scenarios. By determining the reading method corresponding to the registration and discovery components, and creating the route launcher from the dependencies based on the determined reading method, the registration and discovery components can read the route launcher. A configuration module is used to write a configuration file for the route initiator and migrate the configuration corresponding to the route initiator to the registration and discovery components through the configuration file. The routing module is used to receive service requests through a unified path routing port and to route and forward the received service requests according to the configured registration and discovery components.
7. The apparatus according to claim 6, characterized in that, The import module is also used to obtain the dependencies corresponding to the route launcher and determine the reading method corresponding to the registration and discovery components; based on the determined reading method, the dependencies are made into the route launcher, and the route launcher is imported into the registration and discovery components.
8. An electronic device, characterized in that, The device includes one or more processors; and a storage device for storing one or more computer programs that, when executed by the one or more processors, cause the electronic device to perform the method as described in any one of claims 1-5.
9. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by the processor of the electronic device, causes the electronic device to perform the method as described in any one of claims 1-5.