CN112416612B - Service calling method and device, computer equipment and readable storage medium - Google Patents
Service calling method and device, computer equipment and readable storage medium Download PDFInfo
- Publication number
- CN112416612B CN112416612B CN202010814044.3A CN202010814044A CN112416612B CN 112416612 B CN112416612 B CN 112416612B CN 202010814044 A CN202010814044 A CN 202010814044A CN 112416612 B CN112416612 B CN 112416612B
- Authority
- CN
- China
- Prior art keywords
- service
- module
- target
- metadata
- calling
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/955—Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
- G06F16/9566—URL specific, e.g. using aliases, detecting broken or misspelled links
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/549—Remote execution
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
The application provides a service calling method, a service calling device, computer equipment and a readable storage medium based on a routing gateway. The method comprises the following steps: generating module metadata of a plurality of modules in a compiling period, and summarizing the module metadata; performing completeness check on the summarized module metadata and generating a corresponding summarized entry class; registering the summary entry class with a service registry; and responding to a service calling request, discovering a target service corresponding to the service calling request through the service registration center, and calling the target service. By the aid of the method and the device, loop-free and corresponding dependence can be guaranteed, and team collaborative development efficiency is greatly improved.
Description
Technical Field
The present application relates to the field of application publishing technologies, and in particular, to a service invocation method and apparatus based on a routing gateway, a computer device, and a readable storage medium.
Background
Android (Android) is a free and open source operating system based on the Linux kernel (without GNU components) that is mainly used in mobile devices such as smart phones and tablets, led and developed by Google corporation and the open cell phone alliance (Google), usa.
The execution process of the program is the calling process of the method, and the method calling inevitably causes the object to generate dependence with the object, unless one object does not participate in the running of the program, the object is like an island and does not have any interaction with other objects, but the object has no value. Therefore, any one object must have a dependency relationship with one or more other objects in the program code. A method call is the most common reason for generating dependency, an object must necessarily communicate with other objects (unless all code logic is written inside the object), communication usually means call of a method, that is, it means that there is a dependency relationship between the two objects (at least the reference of other objects can call the method), and another common reason for generating dependency is inheritance.
The object loop-dependent method comprises the following steps that a plurality of objects are circularly and nested in reference to generate loop dependence, and objects which are circularly dependent are circularly called all the time when running until memory overflow is reported in error. In order to measure the degree of dependency between objects, the concept of "coupling" is introduced, and the higher the degree of coupling, the higher the degree of dependency between objects is. Under the condition that multiple teams develop an Android application together, a general technology is needed to reduce the code coupling degree among the teams, the most common technologies comprise a bus, a route, a ServiceLoader (a development mode depending on inversion) and the like, and the most core ideas of the several schemes are that a message, an object or a starting page are registered and distributed through an intermediate SDK.
However, attempting to distribute all content with fixed format keys for paths or conventions lacks strong types of constraints and furthermore does not handle URIs (resource identifiers) well, such as the need to map or escape HTTP URIs; the processing approach of relying inversion like ServiceLoader lacks the life cycle and dependency checking between services and is cumbersome.
Disclosure of Invention
The present application aims to provide a service invocation method, device, computer equipment and readable storage medium based on a routing gateway, which are used for solving the above technical problems in the prior art.
In one aspect, a service invocation method is provided for achieving the above object.
The service calling method comprises the following steps: generating module metadata of a plurality of modules in a compiling period, and summarizing the module metadata; performing completeness check on the summarized module metadata and generating a corresponding summarized entry class; registering the summary entry class with a service registry; and responding to a service calling request, discovering a target service corresponding to the service calling request through the service registration center, and calling the target service.
Further, the step of performing a completeness check on the summarized module metadata and generating corresponding summarized entry classes includes: performing a completeness check on the summarized module metadata; and if the completeness check is successfully executed, generating a corresponding summary entry class.
Further, the step of performing a completeness check on the aggregated module metadata includes: generating a configuration file corresponding to the summarized module metadata; performing a completeness check on the aggregated module metadata based on the configuration file.
Further, the completeness check comprises: checking the dependency relationship; a loop dependency check.
Further, in response to a service invocation request, discovering, by the service registry, a target service corresponding to the service invocation request, and invoking the target service includes: performing matching on the target resource identifier based on a preset path rule; skipping to the target page obtained by matching, and loading a first module; and responding to the service calling request of the first module, discovering a target service corresponding to the service calling request through the service registration center, and calling the target service.
Further, the step of performing matching on the target resource identifier based on the preset path rule includes: determining a routing type corresponding to the target resource identifier; and performing matching on the target resource identifier based on the routing type and a preset path rule.
Further, in response to a service invocation request, discovering, by the service registry, a target service corresponding to the service invocation request, and invoking the target service includes: responding to a service calling request of a first module, discovering a target service corresponding to the service calling request through the service registration center, and calling the target service; wherein the target service is provided by a second module, and the first module and the second module are Gradle modules respectively and are mutually dependent; the first module comprises a first implementation component and a first interface component, the second module comprises a second implementation component and a second interface component, and the target service is called based on the second interface component.
In another aspect, to achieve the above object, the present application provides a service invocation device based on a routing gateway.
The service calling device based on the routing gateway comprises: the metadata generation module is used for generating module metadata of a plurality of modules in a compiling period and summarizing the module metadata; the completeness check module is used for executing completeness check on the summarized module metadata and generating a corresponding summarized entry class; the registration module is used for registering the summary entrance class to a service registration center; and the service calling module is used for responding to a service calling request, discovering a target service corresponding to the service calling request through the service registration center and calling the target service.
To achieve the above object, the present application also provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the above method when executing the computer program.
To achieve the above object, the present application also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the above method.
The service calling method, the service calling device, the computer equipment and the readable storage medium based on the routing gateway generate a plurality of service metadata of services to be called in a compiling period, and summarize the service metadata; performing completeness check on the summarized service metadata and generating a summarized entry class corresponding to the service to be called; registering the summary entry class with a service registry; responding to the service calling request, discovering a target service corresponding to the service calling request through a service registration center, and calling the target service; therefore, the completeness of the service module to be called is guaranteed in the compiling period, no loop and corresponding dependence are guaranteed, and the team collaborative development efficiency is greatly improved.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart of a service invocation method according to an embodiment of the present application;
FIGS. 2a and 2b are schematic diagrams of prior art solutions for processing loop dependencies, respectively;
FIG. 3 is a schematic diagram of path matching of URIs in an embodiment of the present application;
fig. 4 is a block diagram of a service invocation device according to a second embodiment of the present application;
fig. 5 is a hardware structure diagram of a computer device according to a third embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of and not restrictive on the broad application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In terms of the prior art, the most common technologies for reducing the code coupling degree between teams include buses, routing, serviceloaders (a development mode relying on inversion), and the like, and the most core ideas of these solutions are to register and distribute messages, objects, or start pages through an intermediate SDK. However, attempting to distribute all content with fixed format keys for paths or conventions is essentially a dynamic call, achieved on a contract basis, lacks strong types of constraints, and furthermore does not handle URIs well, such as requiring mapping or escaping HTTP URIs; although the processing mode of dependence inversion similar to ServiceLoader well utilizes the interface to ensure the type of the call, each inverted interface is a stateless free node, and the life cycle and the dependence check between services are lacked. In addition (refer to fig. 2 a), based on the ServiceLoader, the interface definitions of the modules (e.g., module a and module B) need to be sunk to a common module, or an interface (API) module needs to be separately created for each module that needs to expose a service (refer to fig. 2B), so as to achieve the purpose of implementing shielding, which is very cumbersome.
Based on the above research of the inventor, the present application provides a service invocation method, apparatus, computer device and readable storage medium based on a routing gateway. Based on the service calling method based on the routing gateway, module metadata of a plurality of modules are generated in a compiling period, and the module metadata are summarized; performing completeness check on the summarized module metadata and generating a corresponding summarized entry class; registering the summary entry class with a service registry; responding to the service calling request, discovering a target service corresponding to the service calling request through the service registration center, and calling the target service; therefore, the completeness of the module of the service to be called is guaranteed in the compiling period, loop-free and corresponding dependence is guaranteed, and the team collaborative development efficiency is greatly improved.
Specific embodiments of the service invocation method, device, computer equipment and readable storage medium based on the routing gateway provided by the present application will be described in detail below.
Example one
The embodiment of the application provides a service calling method based on a routing gateway, and the completeness of a module of a service to be called is guaranteed in a compiling period, so that loop-free and corresponding dependence is ensured, and the team cooperation development efficiency is greatly improved. Specifically, fig. 1 is a flowchart of a service invoking method based on a routing gateway according to an embodiment of the present application, and as shown in fig. 1, the service invoking method based on a routing gateway according to the embodiment includes steps S101 to S104 as follows.
Step S101: module metadata for a plurality of modules is generated during compile time and aggregated.
Specifically, in one embodiment, the corresponding metadata is generated by using a Java APT (Annotation Processing Tool) technology, and then the corresponding code is generated according to the metadata, that is, the corresponding Java file is generated through an APT interface. Annotation (Annotation), also called metadata, a code level specification, is a property introduced by JDK1.5 and later versions, at the same level as classes, interfaces, enumerations, which can be declared in front of packages, classes, fields, methods, local variables, method parameters, etc., to specify and annotate these elements.
Step S102: a completeness check is performed on the summarized module metadata and a corresponding summarized entry class is generated.
One purpose of performing completeness check on metadata is to ensure the integrity of information, and to perform check in summary when an Application (APP) is constructed to ensure that there is no loop dependency, thereby ensuring the completeness of a module of a service to be called during a compilation period, ensuring that there is no loop and corresponding dependency, and greatly improving the efficiency of team collaborative development.
Step S103: and registering the summary entry class to a service registry.
Before providing services to the outside, each module must register in a registration center; and all accesses are accessed through the service gateway, and then the service gateway routes the access to the corresponding service center for interactive access. Specifically, the gateway layer accepts the registration of each module, and the module may contain URI (resource), service (interface or class), and executes the life cycle or task of the module when loading the module or acquiring the service, thereby reducing the coupling between the modules.
Step S104: and responding to a service calling request, discovering a target service corresponding to the service calling request through the service registration center, and calling the target service.
Wherein the service invocation request is issued by a module invoking the target service.
So far, the service calling process is finished.
Optionally, in an embodiment, the step S102 includes:
substep S102a (not shown): performing a completeness check on the summarized module metadata;
sub-step S102b: and if the completeness check is successfully executed, generating a corresponding summary entry class.
That is, after the completeness check of the summarized module metadata is passed, the corresponding summarized entry class is generated, otherwise, an error is reported so as to check whether the related content (including the service related to the dependency relationship and needing to be exposed) is complete; when the completeness check relates to a cyclic dependency check, if an error is reported, an operator needs to check and eliminate the cyclic dependency.
Optionally, in an embodiment, the completeness check is performed based on the added configuration file. Specifically, in the sub-step S102a, a configuration file corresponding to the summarized module metadata is generated, and the completeness check is performed on the summarized module metadata based on the configuration file. The configuration file contains summary information of module metadata, and thus in addition to being used to perform the aforementioned completeness check, in one embodiment, the configuration file is also used to generate the aforementioned summary entry class, so that repeated acquisition of information of multiple modules is not required, and thus the processing efficiency is greatly improved. That is, in the above sub-step S102b, if the completeness check is successfully executed, a corresponding summary entry class is generated based on the configuration file.
Optionally, in an embodiment, the completeness check includes a dependency check and a cyclic dependency check.
The dependency check is mainly used for checking whether related content (including services related to the dependency, which need to be exposed) is complete, and if the related content is incomplete (for example, a module declares to depend on another module, but the depended module does not expose the corresponding service), an error is reported; and the cyclic dependency check is mainly used for checking whether the APIs of each module are mutually dependent, and if the APIs are mutually dependent, an error is reported. Through the dependency relationship check and the cyclic dependency check, the completeness of the service module to be called can be guaranteed, loop-free and corresponding dependency can be guaranteed, and the efficiency of team collaborative development can be improved.
Optionally, in an embodiment, the step S104 includes:
substep S104a (not shown): performing matching on a target resource identifier (URI) based on a preset path rule;
sub-step S104b (not shown): skipping to the target page obtained by matching, and loading a first module;
substep S104c (not shown): and responding to the service calling request of the first module, discovering a target service corresponding to the service calling request through the service registration center, and calling the target service.
The service calling method provided by the application provides the SDK as a gateway layer of the micro-service, shields the details of the internal micro-service outwards, only exposes the URI, and embeds a uniform routing protocol for routing skip for specific routing logic. The unified routing protocol is a routing protocol packaged based on a URI format and is divided into two stages of declaration and matching.
For the declaration phase:
the declaration of the path rule supports the following 3 ways (priority from high to low):
1. compounding, for example: (? < capture _ name > is optional, the brackets are nestable, as are the (bili | http | https) and (bili | htt (p | ps)) matching rules, noting that the strings in the brackets cannot be empty, i.e. support formats such as http (| s) for a while, there may be multiple within a segment;
2. wildcards, e.g., { capture _ name } or { }, where { }, equal, i.e., matched but not captured, can only be one within a segment;
3. prefix,. Only, there can be a tail, such as https:// bili.com/. Will match https:// bili.com/a/b/n, but not https:// bili.com, capture will certainly occur, capture _ name is an empty string.
Wherein, the first two types of routing rules can not cross over "/", and different routing rules are mutually exclusive, and only one type can be applied in each segment. At the same time, the addition of the string KV to the attribute declared as a route is allowed for matching.
For the matching phase:
a standard URI is passed in with some of the queries as part of the protocol.
For example:
names begin with-B, leaving several fixed names for a part of the protocol, and others begin with-B as special parameters to pass to the target, one of which is a routing type, e.g., -Btype = xxx, indicating the type of the target URI, and if not present, trying all types in the code in sequence by default.
Name begins with-A, and the part removed from-A is an attribute in the URI that is used in the matching process, e.g., https:// www.bilibili.com? The abstract = main can extract the browser = main and participate in the route matching.
Optionally, in an embodiment, for the matching process, the sub-step S104a includes:
and determining a route type corresponding to the target resource identifier, and performing matching on the target resource identifier based on the route type and a preset path rule (such as the path rule).
By introducing the routing type, the embodiment can realize routing query according to the uniform routing protocol under the condition that the routing type is not specified, so that the scheme accepts the registration of all URIs without transferring or specially processing the entering URIs, and compared with the existing processing mode, the processing process is greatly simplified.
For the sake of clarity, with reference to fig. 3, the working of the matching phase is exemplified as follows:
when a URI enters a matching process but does not specify the type of a route, a first successfully matched target route is sequentially found in NATIVE/H5, if the URI to be matched is https:// bili.com/video/123, the matching in NATIVE is successful, and if the URI to be matched is https:// bili.com/music, the matching in NATIVE is successful due to the failure of the matching in NATIVE.
The unified routing protocol with the introduced routing types as described above can flexibly achieve downgrade, mutual backup, and no assumptions are made about the URI to be matched (e.g., only scheme is defined as bili or others).
Optionally, in an embodiment, the step S104 includes:
responding to a service calling request of a first module, discovering a target service corresponding to the service calling request through the service registration center, and calling the target service; wherein the target service is provided by a second module, and the first module and the second module are Gradle modules respectively and are mutually dependent; the first module includes a first implementation component and a first interface component, the second module includes a second implementation component and a second interface component, and the target service is invoked based on the second interface component.
The method can directly declare the interface API and the implementation in one module so as to automatically expose the module interface, can only expose the API when the module is directly depended on, and can also automatically release the API and implement the two modules simultaneously when the module is released. Compared with the prior art, the method avoids interface sinking to form a super public interface module, and does not need to independently establish an API module for each module exposing services.
For example, in one particular implementation, for two functional modules, they are made dependent on each other in the Gradle module, thereby masking the implementation from each other, while only exposing the interface API. One method is to add API directories of corresponding modules under the src-main directory respectively and compile codes of API parts independently, so that the API directories are separated from the compiling range of the Android plug-in, and the generation of circular dependence is avoided fundamentally.
Example two
Corresponding to the first embodiment, the second embodiment of the present application provides a service invoking device based on a routing gateway, and reference may be made to the first embodiment for detailed description of related technical features and corresponding technical effects, which are not described herein again. Fig. 4 is a block diagram of a service invocation apparatus for business data according to a second embodiment of the present application, and as shown in fig. 4, the apparatus includes a metadata generation module 201, a completeness check module 202, a registration module 203, and a service invocation module 204.
The metadata generation module 201 is configured to generate module metadata of multiple modules in a compilation period, and summarize the module metadata; a completeness check module 202, configured to perform completeness check on the summarized module metadata and generate a corresponding summarized entry class; a registration module 203, configured to register the summary entry class with the service registry; and the service invoking module 204 is configured to respond to the service invoking request, discover a target service corresponding to the service invoking request through the service registry, and invoke the target service.
Optionally, in one embodiment, completeness check module 202 includes a first sub-module for performing a completeness check on the aggregated module metadata; the second submodule is used for generating a corresponding summary entry class if the completeness check is successfully executed. .
Optionally, in an embodiment, the first sub-module is configured to generate a configuration file corresponding to the summarized module metadata, and perform completeness check on the summarized module metadata based on the configuration file.
Optionally, in an embodiment, the completeness check comprises: checking the dependency relationship; loop dependent checking.
Optionally, in an embodiment, the service invocation module 204 includes a third sub-module, a fourth sub-module, and a fifth sub-module. The third sub-module is used for matching the target resource identifier based on a preset path rule; the fourth sub-module is used for jumping to the target page obtained by matching and loading the first module; and the fifth sub-module is used for responding to the service calling request of the first module, discovering a target service corresponding to the service calling request through the service registration center, and calling the target service.
Optionally, in an embodiment, the third sub-module is configured to determine a routing type corresponding to the target resource identifier, and perform matching on the target resource identifier based on the routing type and a preset path rule.
Optionally, in an embodiment, the service invoking module 204 is configured to, in response to a service invoking request of the first module, discover, by the service registry, a target service corresponding to the service invoking request, and invoke the target service; wherein the target service is provided by a second module, and the first module and the second module are Gradle modules respectively and are mutually dependent; the first module comprises a first implementation component and a first interface component, the second module comprises a second implementation component and a second interface component, and the target service is called based on the second interface component.
EXAMPLE III
A third embodiment further provides a computer device, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server or a rack server (including an independent server or a server cluster formed by multiple servers) capable of executing programs, and the like. As shown in fig. 5, the computer device 01 of the present embodiment at least includes but is not limited to: a memory 011 and a processor 012, which are communicatively connected to each other via a system bus, as shown in fig. 5. It is noted that fig. 5 only shows the computer device 01 having the component memory 011 and the processor 012, but it is to be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
In this embodiment, the memory 011 (i.e., a readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 011 can be an internal storage unit of the computer device 01, such as a hard disk or a memory of the computer device 01. In other embodiments, the memory 011 can also be an external storage device of the computer device 01, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the computer device 01. Of course, the memory 011 can also include both internal and external memory units of the computer device 01. In this embodiment, the memory 011 is generally used for storing an operating system installed in the computer device 01 and various application software, such as program codes of the service invocation apparatus based on the routing gateway in the second embodiment. Further, the memory 011 can also be used to temporarily store various types of data that have been output or are to be output.
Processor 012 can be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 012 is generally used to control the overall operation of the computer device 01. In this embodiment, the processor 012 is configured to run a program code stored in the memory 011 or process data, for example, a method of generating an application component.
Example four
The fourth embodiment further provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application store, etc., on which a computer program is stored, which when executed by a processor implements corresponding functions. The computer-readable storage medium of this embodiment is used for implementing the generation method of the application component of the first embodiment when executed by the processor based on the service invocation device of the routing gateway.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one of 8230, and" comprising 8230does not exclude the presence of additional like elements in a process, method, article, or apparatus comprising the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description, and do not represent the advantages and disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all the equivalent structures or equivalent processes that can be directly or indirectly applied to other related technical fields by using the contents of the specification and the drawings of the present application are also included in the scope of the present application.
Claims (8)
1. A service calling method based on a routing gateway is characterized by comprising the following steps:
generating module metadata of a plurality of modules in a compiling period, and summarizing the module metadata, wherein the modules are modules of services to be called, and the module metadata is declared in front of a packet, a class, a field, a method, a local variable or a method parameter and used for explaining and annotating the elements;
executing completeness check on the summarized module metadata, and if the completeness check is executed successfully, generating a corresponding summarized entry class, wherein the completeness check comprises the following steps: checking a dependency relationship and checking a cyclic dependency relationship, wherein the dependency relationship is used for checking whether services which are related to the dependency relationship and need to be exposed are complete, and the cyclic dependency check is used for checking whether APIs of all modules are dependent on one another;
registering the summary entry class with a service registry; and
and responding to a service calling request, discovering a target service corresponding to the service calling request through the service registration center, and calling the target service.
2. The service invocation method according to claim 1, wherein the step of performing a completeness check on the aggregated module metadata comprises:
generating a configuration file corresponding to the summarized module metadata;
performing a completeness check on the aggregated module metadata based on the configuration file.
3. The service invocation method according to any one of claims 1 to 2, wherein the step of discovering, by the service registry, a target service corresponding to the service invocation request in response to the service invocation request, and invoking the target service comprises:
performing matching on the target resource identifier based on a preset path rule;
skipping to the target page obtained by matching, and loading a first module;
and responding to the service calling request of the first module, discovering a target service corresponding to the service calling request through the service registration center, and calling the target service.
4. The service invocation method according to claim 3, wherein the step of performing matching on the target resource identifier based on the preset path rule comprises:
determining a routing type corresponding to the target resource identifier;
and performing matching on the target resource identifier based on the routing type and a preset path rule.
5. The service invocation method according to any one of claims 1 to 2, wherein the step of discovering, by the service registry, a target service corresponding to the service invocation request in response to the service invocation request, and invoking the target service comprises:
responding to a service calling request of a first module, discovering a target service corresponding to the service calling request through the service registration center, and calling the target service;
wherein the target service is provided by a second module, and the first module and the second module are Gradle modules respectively and are mutually dependent; the first module comprises a first implementation component and a first interface component, the second module comprises a second implementation component and a second interface component, and the target service is called based on the second interface component.
6. A service invoking device based on a routing gateway is characterized by comprising:
the metadata generation module is used for generating module metadata of a plurality of modules in a compiling period and summarizing the module metadata, wherein the modules are modules of services to be called, and module metadata declarations are in front of packages, classes, fields, methods, local variables or method parameters and are used for explaining and annotating the elements;
a completeness check module, configured to perform completeness check on the summarized module metadata, and if the completeness check is successfully performed, generate a corresponding summarized entry class, where the completeness check includes: checking the dependency relationship and checking the cyclic dependency relationship, wherein the dependency relationship is used for checking whether the services related to the dependency relationship and needing to be exposed are complete, and the cyclic dependency check is used for checking whether the APIs of the modules are mutually dependent;
the registration module is used for registering the summary entry class to a service registration center; and
and the service calling module is used for responding to a service calling request, discovering a target service corresponding to the service calling request through the service registration center and calling the target service.
7. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 5 are implemented by the processor when executing the computer program.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that: the computer program when executed by a processor implements the steps of the method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010814044.3A CN112416612B (en) | 2020-08-13 | 2020-08-13 | Service calling method and device, computer equipment and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010814044.3A CN112416612B (en) | 2020-08-13 | 2020-08-13 | Service calling method and device, computer equipment and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112416612A CN112416612A (en) | 2021-02-26 |
CN112416612B true CN112416612B (en) | 2023-03-28 |
Family
ID=74853940
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010814044.3A Active CN112416612B (en) | 2020-08-13 | 2020-08-13 | Service calling method and device, computer equipment and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112416612B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113918239B (en) * | 2021-10-14 | 2024-05-17 | 上海幻电信息科技有限公司 | Code implementation method and system |
CN114979143B (en) * | 2022-05-19 | 2024-04-16 | 中国银行股份有限公司 | Distributed service implementation method and distributed service system |
CN115589435A (en) * | 2022-09-22 | 2023-01-10 | 南方电网数字平台科技(广东)有限公司 | Routing control method and device based on intelligent gateway |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107203535A (en) * | 2016-03-16 | 2017-09-26 | 阿里巴巴集团控股有限公司 | Information query method and device |
CN109445923A (en) * | 2018-11-01 | 2019-03-08 | 郑州云海信息技术有限公司 | A kind of method and device of micro services task schedule |
CN110308900A (en) * | 2019-06-27 | 2019-10-08 | 广州华多网络科技有限公司 | Generation method, device, computer equipment and the storage medium of page route documents |
CN110377438A (en) * | 2019-07-22 | 2019-10-25 | 广州小鹏汽车科技有限公司 | The method for routing of striding course communication interface, device and system |
CN111045833A (en) * | 2018-10-15 | 2020-04-21 | 北京京东尚科信息技术有限公司 | Interface calling method and device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP6207163B2 (en) * | 2013-01-30 | 2017-10-04 | キヤノン株式会社 | Client, server, management system and method thereof |
-
2020
- 2020-08-13 CN CN202010814044.3A patent/CN112416612B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107203535A (en) * | 2016-03-16 | 2017-09-26 | 阿里巴巴集团控股有限公司 | Information query method and device |
CN111045833A (en) * | 2018-10-15 | 2020-04-21 | 北京京东尚科信息技术有限公司 | Interface calling method and device |
CN109445923A (en) * | 2018-11-01 | 2019-03-08 | 郑州云海信息技术有限公司 | A kind of method and device of micro services task schedule |
CN110308900A (en) * | 2019-06-27 | 2019-10-08 | 广州华多网络科技有限公司 | Generation method, device, computer equipment and the storage medium of page route documents |
CN110377438A (en) * | 2019-07-22 | 2019-10-25 | 广州小鹏汽车科技有限公司 | The method for routing of striding course communication interface, device and system |
Also Published As
Publication number | Publication date |
---|---|
CN112416612A (en) | 2021-02-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112416612B (en) | Service calling method and device, computer equipment and readable storage medium | |
CN111061643B (en) | SDK cluster compatibility detection method and device, electronic equipment and storage medium | |
US8285676B2 (en) | Containment agnostic, N-ary roots leveraged model synchronization | |
CN106569880B (en) | Method and system for dynamically sharing resources between Android applications | |
CN106294113B (en) | creation method and device based on programmable test service | |
CN106339237A (en) | Plug-in loading frame for WEB application in field of JavaEE and method | |
CN112769706B (en) | Componentized routing method and system | |
US11893367B2 (en) | Source code conversion from application program interface to policy document | |
CN108804100B (en) | Method and device for creating interface element, storage medium and mobile terminal | |
CN111651169B (en) | Block chain intelligent contract operation method and system based on web container | |
CN111309332A (en) | File content on-demand loading method and device, electronic equipment and storage medium | |
US9411618B2 (en) | Metadata-based class loading using a content repository | |
CN111045746B (en) | Code expansion method and framework | |
CN107977243A (en) | A kind of third party's interface call method and device | |
CN111399842B (en) | Code compiling method and device | |
CN110941443B (en) | Method and device for modifying file name in SDK (software development kit) and electronic equipment | |
CN112114871A (en) | Code sharing method, device, server, terminal and medium | |
CN116578282A (en) | Code generation method, device, electronic equipment and medium | |
CN111651469B (en) | Method and device for managing blockchain system contracts | |
CN110989985B (en) | Maven-based dependency package management method, device, computer equipment and storage medium | |
CN111273940B (en) | Method and device for uploading program file to code warehouse | |
CN110704295B (en) | Data calling method, device, equipment and system | |
CN113535566B (en) | Android application verification method, device, equipment and storage medium | |
CN114443316B (en) | Object access method and device and electronic equipment | |
CN111273944B (en) | Method and device for generating program file and uploading program file to code warehouse |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |