CN112214334A - Micro-service calling method and device, electronic equipment and computer-readable storage medium - Google Patents
Micro-service calling method and device, electronic equipment and computer-readable storage medium Download PDFInfo
- Publication number
- CN112214334A CN112214334A CN202011044279.5A CN202011044279A CN112214334A CN 112214334 A CN112214334 A CN 112214334A CN 202011044279 A CN202011044279 A CN 202011044279A CN 112214334 A CN112214334 A CN 112214334A
- Authority
- CN
- China
- Prior art keywords
- micro
- service
- request information
- calling
- architecture
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 77
- 230000004044 response Effects 0.000 claims description 39
- 238000006243 chemical reaction Methods 0.000 claims description 35
- 238000012545 processing Methods 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 5
- 230000003993 interaction Effects 0.000 abstract description 12
- 238000012827 research and development Methods 0.000 abstract description 8
- 230000008569 process Effects 0.000 description 7
- 238000010586 diagram Methods 0.000 description 6
- 238000004891 communication Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000005034 decoration Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
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
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer And Data Communications (AREA)
Abstract
The embodiment of the application provides a micro-service calling method and device, electronic equipment and a computer-readable storage medium, and relates to the field of micro-service calling. The method comprises the following steps: receiving calling request information from a micro-service calling party, wherein the calling request information at least comprises the micro-service calling party information and architecture information of a micro-service architecture to which the micro-service calling party belongs; generating virtual request information corresponding to the current micro service architecture according to the calling request information; and executing the calling of the target micro service in the current micro service architecture according to the virtual request information. According to the micro-service calling request information, the virtual request information corresponding to the current micro-service framework is generated, so that the micro-service between different micro-service frameworks is called directly and originally without being converted into a standard protocol, and a calling party does not need to sense the heterogeneous micro-service framework, so that the micro-service interaction efficiency between different frameworks is improved, and the research and development cost is reduced.
Description
Technical Field
The present application relates to the technical field of micro service invocation, and in particular, to a micro service invocation method, an apparatus, an electronic device, and a computer-readable storage medium.
Background
In the field of software development, micro services have become mainstream, and many micro service frames such as Spring Cloud/Dubbo, etc. are mainstream in the market at present, and when a project is implemented, especially in the process of large-scale project transformation and iteration, different services generally have different choices for the micro service frames due to factors such as historical reasons and technical development trends, but application services adopting different micro service frames cannot be directly communicated with each other, and often need to be detoured to an interface or gateway layer through a standard protocol to be called, so that the efficiency is greatly reduced due to the interaction mode through detour, and the development cost and the system maintenance requirement are higher.
Disclosure of Invention
The application provides a micro-service calling method, a micro-service calling device, electronic equipment and a computer readable storage medium, which can solve the problem of micro-service calling among different micro-service architectures. The technical scheme is as follows:
in a first aspect, a method for invoking a micro service is provided, where the method includes:
receiving calling request information from a micro-service calling party, wherein the calling request information at least comprises the micro-service calling party information and architecture information of a micro-service architecture to which the micro-service calling party belongs;
generating virtual request information corresponding to the current micro service architecture according to the calling request information;
and executing the calling of the target micro service in the current micro service architecture according to the virtual request information.
In one possible implementation, the generating, according to the call request information, virtual request information corresponding to the current micro service architecture includes:
and converting the calling request information according to the architecture information of the micro service architecture to which the micro service calling party belongs and a preset information conversion method between the micro service architectures to generate virtual request information corresponding to the current micro service architecture.
In another possible implementation manner, converting the invocation request information according to an information conversion method between preset micro service architectures, and generating virtual request information corresponding to a current micro service architecture includes:
and performing protocol conversion on the calling request information according to a preset protocol conversion method between the micro service architectures to generate virtual request information corresponding to the protocol supported by the current micro service architecture.
In another possible implementation, the method further includes:
generating response information in response to executing a call to a target microservice in a current microservice architecture;
and converting the response information according to a preset information conversion method between the micro service frameworks to generate virtual response information corresponding to the micro service framework to which the micro service caller belongs.
In yet another possible implementation, the method further includes:
and outputting the virtual response information to the micro-service calling party for the micro-service calling party to perform service processing.
In a second aspect, a micro-service invocation apparatus is provided, the apparatus comprising:
the request receiving module is used for receiving calling request information from the micro-service calling party, wherein the calling request information at least comprises the micro-service calling party information and the architecture information of the micro-service architecture to which the micro-service calling party belongs;
the virtual request generating module is used for generating virtual request information corresponding to the current micro-service architecture according to the calling request information;
and the call execution module is used for executing the call of the target micro service in the current micro service architecture according to the virtual request information.
In one possible implementation, the generating, according to the call request information, virtual request information corresponding to the current micro service architecture includes:
and converting the calling request information according to the architecture information of the micro service architecture to which the micro service calling party belongs and a preset information conversion method between the micro service architectures to generate virtual request information corresponding to the current micro service architecture.
In another possible implementation manner, converting the invocation request information according to an information conversion method between preset micro service architectures, and generating virtual request information corresponding to a current micro service architecture includes:
and performing protocol conversion on the calling request information according to a preset protocol conversion method between the micro service architectures to generate virtual request information corresponding to the protocol supported by the current micro service architecture.
In a third aspect, an electronic device is provided, which includes:
one or more processors;
a memory;
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: executing the microservice calling method according to any of claims 1 to 5.
For example, in a third aspect of the present application, there is provided a computing device comprising: the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction enables the processor to execute the operation corresponding to the micro-service calling method as shown in the first aspect of the application.
In a fourth aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the microservice invocation method of any of claims 1-5.
For example, in a fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored, and the computer program, when executed by a processor, implements the micro service invocation method shown in the first aspect of the present application.
The beneficial effect that technical scheme that this application provided brought is:
according to the micro-service calling request information, the virtual request information corresponding to the current micro-service framework is generated, so that the micro-service between different micro-service frameworks is called without converting into a standard protocol but directly calling originally, and a calling party does not need to sense the heterogeneous micro-service framework, so that the micro-service interaction efficiency between different frameworks is improved, and the research and development cost is reduced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments of the present application will be briefly described below.
FIG. 1 is a diagram illustrating a scenario of a call process of a microservice in the prior art according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a method for invoking a micro service according to an embodiment of the present disclosure;
fig. 3 is a second schematic flowchart of a method for invoking micro-services according to an embodiment of the present application;
fig. 4 is a schematic view of an application scenario of a micro service invocation method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a micro service invocation device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device for micro service invocation according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to the embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present invention.
As used herein, the singular forms "a", "an", "the" and "the" include plural referents unless the context clearly dictates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
For better understanding and description of the solution of the embodiments of the present application, the following briefly describes the technical terms involved in the embodiments of the present application:
micro-service: the microservice is a program or service which divides an application of a single architecture into individual and independent running programs according to business.
Micro-service architecture: a large single application and service is split into several or even tens of supporting microservices that can extend a single component rather than the entire application stack to meet service level agreements.
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
In the field of software development, micro services have become mainstream, many micro service architectures, such as Spring Cloud/Dubbo, etc., currently mainstream in the market, when a project is implemented, especially in the process of large project transformation and iteration, different services generally have different choices for the micro service architecture due to factors such as historical reasons and technical development trends, but application services adopting different micro service architectures cannot be directly communicated with each other, for example, as shown in fig. 1, the micro service architecture is a scene schematic diagram of a calling process of the micro service in the prior art of the embodiment of the present application, as shown in the drawing, when an application based on the micro service architecture a is called for an application based on the micro service architecture B, direct calling cannot be realized due to different micro service architecture systems, and therefore, a detour is often required to be realized through an interface platform or a service gateway of a standard protocol, thus, this interaction via detour results in a significant loss of efficiency.
Therefore, in order to solve the above technical problem, embodiments of the present application provide a method and an apparatus for invoking a micro service, an electronic device, and a computer-readable storage medium, which generate virtual request information corresponding to a current micro service architecture according to micro service invocation request information, so that direct native invocation is performed without converting into a standard protocol when micro service invocation is performed between different micro service architectures, thereby improving efficiency of micro service interaction between different architectures.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
The embodiment of the application provides a method for invoking micro-services, and an execution main body of the method can be terminals or server equipment of various application micro-service architecture systems, and can also be devices or chips integrated on the equipment, for example, computer equipment of the application micro-service architecture systems, and the like. As shown in fig. 2, which is a schematic flow chart of a method for invoking a micro service according to an embodiment of the present application, the method includes the following steps:
s201: and receiving calling request information from the micro-service caller.
The calling request information at least includes micro-service caller information and architecture information of a micro-service architecture to which the micro-service caller belongs. In addition, target microservice information in the current microservice architecture as the invoker of the microservice may also be included. Specifically, in a scenario of executing a service process, the micro service invoker may be a service application in the service system that executes a specific function, and the micro service invoker information may at least include network identification information of the micro service invoker, for example, the network identification information of the micro service invoker may be identified by predefined code or text information. For example, the network identification of the microservice order center for processing order traffic may be represented by the numerical code "001" or the textual information "order center". The architecture information of the micro service architecture to which the micro service invoker belongs may include at least network identification information of the micro service architecture and architecture type information of the micro service architecture. For example, the network identification information of the micro service architecture may be identified by predefined codes or text information, and the type of the micro service architecture to which the micro service invoker belongs may be one of Spring Cloud, Dubbo, and Golang.
S202: and generating virtual request information corresponding to the current micro service architecture according to the calling request information.
Specifically, the calling request information may be converted according to the architecture information of the micro service architecture to which the micro service caller belongs in the step S102 and according to a preset information conversion method between the micro service architectures, so as to generate the virtual request information corresponding to the current micro service architecture.
For example, the invocation request information may be converted according to the architecture type information of the micro service architecture to which the micro service invoker belongs and the architecture type information of the current micro service architecture, and according to a protocol conversion method, a data conversion method, and the like preset between the architecture types of the two micro service architectures, so as to generate the virtual request information corresponding to the protocol supported by the current micro service architecture. The virtual request information is generated by converting the calling request information based on the micro-service architecture to which the micro-service caller belongs and the architecture type of the current micro-service architecture, so that the virtual request information may include the virtual micro-service caller information corresponding to the current micro-service architecture, the architecture information of the micro-service architecture to which the virtual micro-service caller belongs, and the virtual target micro-service information in the current micro-service architecture as the micro-service callee.
S203: and executing the calling of the target micro service in the current micro service architecture according to the virtual request information.
Specifically, according to the virtual request information corresponding to the current micro service architecture generated in step S102, the micro service invoker is executed to invoke the target micro service in the current micro service architecture.
According to the micro-service calling request information, the virtual request information corresponding to the current micro-service framework is generated, so that the micro-service between different micro-service frameworks is called without converting into a standard protocol but directly calling originally, and a calling party does not need to sense the heterogeneous micro-service framework, so that the micro-service interaction efficiency between different frameworks is improved, and the research and development cost is reduced.
In an embodiment of the present application, a possible implementation manner is provided, as shown in fig. 3, which is a second flowchart of a method for invoking a micro service, provided in an embodiment of the present application, and the method includes the following steps:
s301: and receiving calling request information from the micro-service caller.
Specifically, step S301 is the same as step S201 in the embodiment shown in fig. 2, and is not described here again.
Step S202 in the embodiment shown in fig. 2 may specifically include the following steps S302 and S303.
S302: and performing protocol conversion on the calling request information according to a preset protocol conversion method between the micro service architectures to generate virtual request information corresponding to the protocol supported by the current micro service architecture.
Specifically, the call request information may be converted according to the architecture type information of the micro service architecture to which the micro service caller belongs and the architecture type information of the current micro service architecture, and according to a protocol conversion method preset between the two architecture types of the micro service architecture, so as to generate the virtual request information corresponding to the protocol supported by the current micro service architecture. Therefore, the virtual request information may include virtual micro service invoker information corresponding to a protocol supported by the current micro service architecture, architecture information of the micro service architecture to which the virtual micro service invoker belongs, and virtual target micro service information in the current micro service architecture as the micro service invoker.
S303: and executing the calling of the target micro service in the current micro service architecture according to the virtual request information.
Specifically, step S303 is the same as step S203 in the embodiment shown in fig. 2, and is not described here again.
S304: responsive to executing the call to the target microservice in the current microservice architecture, response information is generated.
Specifically, after the execution of the call to the target micro service in the current micro service architecture in step S303, response information corresponding to the execution of the target micro service is generated, where the response information may include execution result information of the execution call target micro service, and virtual micro service caller information corresponding to the current micro service architecture that receives the response information.
S305: and converting the response information according to a preset information conversion method between the micro service frameworks to generate virtual response information corresponding to the micro service framework to which the micro service caller belongs.
Specifically, the response information may be converted according to a preset protocol conversion method between the micro service architecture to which the micro service invoker belongs and the current micro service architecture, so as to generate virtual response information corresponding to a protocol supported by the architecture to which the micro service invoker belongs. Accordingly, the virtual response information may include virtual execution result information corresponding to the micro service architecture to which the micro service invoker belongs, and micro service invoker information that receives the virtual response information.
S306: and outputting the virtual response information to the micro-service calling party for the micro-service calling party to perform service processing.
According to the method, the protocol conversion is carried out on the calling request information according to the preset protocol conversion method between the micro service architectures, and the virtual request information corresponding to the protocol supported by the current micro service architecture is generated, so that the micro service between different micro service architectures is called directly and originally without being converted into a standard protocol, and the calling party does not need to sense the heterogeneous micro service architecture, the efficiency of micro service interaction between different architectures is improved, and the research and development cost is reduced.
In an embodiment of the present application, a possible implementation manner is provided, as shown in fig. 4, which is an application scenario diagram of a micro-service invocation method provided in the embodiment of the present application, and the following further describes a technical solution of the embodiment of the present application with reference to fig. 4.
As shown in fig. 4, the scenario is an order creation flow when a user purchases a commodity on the internet, and the micro-service invoking method of the present application will be described below with reference to a processing operation sequence of the order creation flow.
Specifically, in the scenario, in the order creation process for processing the online purchased goods of the user, the micro service for processing the order information is an order center, and the micro service for processing the goods information is a goods center, where the order center and the goods center may be based on multiple micro service architectures, for example, the order center may be based on a Dubbo architecture, and the goods center may be based on a Spring Cloud architecture, so that after the user clicks and submits the goods selected for purchase on the APP of the terminal device, the corresponding network request for creating the order is configured to the order center through the gateway, and the order center calls the goods center, so as to query the goods information selected by the user.
Since the order center as the micro-service caller and the commodity center as the micro-service callee are based on different micro-service architectures, when the order center calls the commodity center, the order center executes the micro-service calling method in the embodiment of the present application through the commodity center virtual service to realize the calling of the order center to the commodity center.
Specifically, after receiving a network request for creating an order, the order center sends, to the commodity center virtual service, invocation request information based on a Dubbo protocol supported by the Dubbo architecture, where the invocation request information may include network identification information of the order center, network identification information and architecture type information of a micro service architecture to which the order center belongs, and network identification information of a target micro service to be invoked, that is, network identification information of the commodity center. For convenience of description, the above information may be represented by text information and numerical information, for example, the network identification information of the order center may be represented as "order center-Dubbo", the network identification information of the micro service architecture to which the order center belongs may be represented as "order center architecture-Dubbo", the architecture type information may be represented as "001-Dubbo", and the network identification information of the target micro service to be invoked, i.e., the product center, may be represented as "product center-Dubbo".
After receiving the calling request information, the commodity center virtual service converts the calling request information according to a protocol conversion method between a Dubbo architecture to which the order center belongs and a Spring Cloud architecture to which the current commodity center belongs in the calling request information, and generates virtual request information of a restful protocol corresponding to the support of the Spring Cloud architecture of the current commodity center. For example, the virtual request information may include virtual micro-service invoker information "order center-restful", architecture information "order center architecture-restful" of a micro-service architecture to which the virtual micro-service invoker belongs, and architecture type information "001-restful", virtual target micro-service information "commodity center-restful" in a current micro-service architecture as the micro-service invoker. It should be noted that the above representations are only exemplary representations made for illustrating the micro service invocation method according to the embodiment of the present application.
Then, based on the virtual request information, a call to a target service, i.e., a commodity center, is executed.
Further, after the above-mentioned execution of the call to the commodity center, that is, the commodity center makes a commodity inquiry, a response message is generated accordingly, where the response message may include the execution result message and the virtual micro-service caller information corresponding to the accepted response message of the current micro-service architecture. Also, the response information is response information of the restful protocol based on the support of the Spring Cloud architecture, for example, for convenience of description, the execution result information included in the response information may be exemplarily represented as "result information-restful" and the virtual micro service invoker information corresponding to the acceptance response information of the current micro service architecture may be represented as "order center-restful".
Further, the product center virtual service converts the response information according to a protocol conversion method between the Dubbo architecture to which the order center belongs and the Spring Cloud architecture to which the current product center belongs, and generates virtual response information of the Dubbo protocol supported by the Dubbo architecture corresponding to the order center, for example, the virtual response information may include virtual execution result information "result information-Dubbo" corresponding to the micro-service architecture to which the micro-service invoker belongs, and micro-service invoker information "order center-Dubbo".
And further outputting the virtual response information to an order center for the order center to create an order according to the virtual response information.
According to the method, the protocol conversion is carried out on the calling request information according to the preset protocol conversion method between the micro service architectures, and the virtual request information corresponding to the protocol supported by the current micro service architecture is generated, so that the micro service between different micro service architectures is called directly and originally without being converted into a standard protocol, and the calling party does not need to sense the heterogeneous micro service architecture, the efficiency of micro service interaction between different architectures is improved, and the research and development cost is reduced.
An embodiment of the present application provides a micro service invoking device, as shown in fig. 5, which is a schematic structural diagram of the micro service invoking device provided in the embodiment of the present application, and the invoking device 50 may include: a request receiving module 501, a virtual request generating module 502, a call executing module 503, wherein,
a request receiving module 501, configured to receive call request information from a micro service caller.
Specifically, the call request information may include at least micro-service caller information and architecture information of a micro-service architecture to which the micro-service caller belongs. In addition, target microservice information in the current microservice architecture as the invoker of the microservice may also be included.
The virtual request generating module 502 is configured to generate virtual request information corresponding to the current micro service architecture according to the call request information.
Specifically, the calling request information may be converted according to architecture information of the micro service architecture to which the micro service caller belongs and a preset information conversion method between the micro service architectures, so as to generate virtual request information corresponding to the current micro service architecture.
Further, the call request information may be converted according to the architecture type information of the micro service architecture to which the micro service caller belongs and the architecture type information of the current micro service architecture, and according to a protocol conversion method preset between the two architecture types of the micro service architecture, so as to generate the virtual request information corresponding to the protocol supported by the current micro service architecture.
The call execution module 503 is configured to execute a call to a target microservice in the current microservice architecture according to the virtual request information.
In addition, the device can further comprise a response module and an output module, wherein the response module is used for responding to the calling of the target micro service in the current micro service architecture and generating response information; and converting the response information according to a preset information conversion method between the micro service frameworks to generate virtual response information corresponding to the micro service framework to which the micro service caller belongs. The output module is used for outputting the virtual response information to the micro-service calling party so as to be used for the micro-service calling party to carry out service processing.
The micro service invoking device of this embodiment may execute the micro service invoking method shown in the foregoing embodiments of this application, and the implementation principles thereof are similar, and are not described herein again.
According to the micro-service calling request information, the virtual request information corresponding to the current micro-service framework is generated, so that the micro-service between different micro-service frameworks is called without converting into a standard protocol but directly calling originally, and a calling party does not need to sense the heterogeneous micro-service framework, so that the micro-service interaction efficiency between different frameworks is improved, and the research and development cost is reduced.
An embodiment of the present application provides an electronic device, including: a memory and a processor; at least one program stored in the memory for execution by the processor, which when executed by the processor, implements: according to the micro-service calling request information, the virtual request information corresponding to the current micro-service framework is generated, so that the micro-service between different micro-service frameworks is called without converting into a standard protocol but directly calling originally, and a calling party does not need to sense the heterogeneous micro-service framework, so that the micro-service interaction efficiency between different frameworks is improved, and the research and development cost is reduced.
In an alternative embodiment, an electronic device is provided, as shown in fig. 6, the electronic device 4000 shown in fig. 6 comprising: a processor 4001 and a memory 4003. Processor 4001 is coupled to memory 4003, such as via bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, and the transceiver 4004 may be used for data interaction between the electronic device and other electronic devices, such as transmission of data and/or reception of data. In addition, the transceiver 4004 is not limited to one in practical applications, and the structure of the electronic device 4000 is not limited to the embodiment of the present application.
The Processor 4001 may be a CPU (Central Processing Unit), a general-purpose Processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, a transistor logic device, a hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 4001 may also be a combination that performs a computational function, including, for example, a combination of one or more microprocessors, a combination of a DSP and a microprocessor, or the like.
The Memory 4003 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical Disc storage, optical Disc storage (including Compact Disc, laser Disc, optical Disc, digital versatile Disc, blu-ray Disc, etc.), a magnetic Disc storage medium or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to these.
The memory 4003 is used for storing application codes for executing the scheme of the present application, and the execution is controlled by the processor 4001. Processor 4001 is configured to execute application code stored in memory 4003 to implement what is shown in the foregoing method embodiments.
Among them, electronic devices include but are not limited to: mobile phones, notebook computers, multimedia players, desktop computers, and the like.
The present application provides a computer-readable storage medium, on which a computer program is stored, which, when running on a computer, enables the computer to execute the corresponding content in the foregoing method embodiments. Compared with the prior art, the virtual request information corresponding to the current micro-service architecture is generated according to the micro-service calling request information, so that the micro-service calling between different micro-service architectures is realized without converting into a standard protocol, but direct primary calling is carried out, and a calling party does not need to sense the heterogeneous micro-service architecture, so that the micro-service interaction efficiency between different architectures is improved, and the research and development cost is reduced.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.
Claims (10)
1. A method for invoking a micro-service, comprising:
receiving calling request information from a micro-service caller, wherein the calling request information at least comprises the micro-service caller information and architecture information of a micro-service architecture to which the micro-service caller belongs;
generating virtual request information corresponding to the current micro service architecture according to the calling request information;
and executing the calling of the target micro service in the current micro service architecture according to the virtual request information.
2. The calling method according to claim 1, wherein the generating virtual request information corresponding to a current micro service architecture according to the calling request information comprises:
and converting the calling request information according to the architecture information of the micro service architecture to which the micro service calling party belongs and a preset information conversion method between the micro service architectures to generate virtual request information corresponding to the current micro service architecture.
3. The calling method according to claim 2, wherein the converting the calling request information according to an information conversion method between preset micro service architectures, and generating the virtual request information corresponding to the current micro service architecture comprises:
and carrying out protocol conversion on the calling request information according to a preset protocol conversion method between the micro service architectures to generate virtual request information corresponding to the protocol supported by the current micro service architecture.
4. The calling method of claim 1, wherein the method further comprises:
generating response information in response to the executing the call to the target microservice in the current microservice architecture;
and converting the response information according to an information conversion method between the preset micro service architectures to generate virtual response information corresponding to the micro service architecture to which the micro service caller belongs.
5. The calling method of claim 1, wherein the method further comprises:
and outputting virtual response information to the micro service caller for the micro service caller to perform service processing.
6. A microservice invocation device, comprising:
the request receiving module is used for receiving calling request information from a micro-service calling party, wherein the calling request information at least comprises the micro-service calling party information and architecture information of a micro-service architecture to which the micro-service calling party belongs;
the virtual request generating module is used for generating virtual request information corresponding to the current micro-service architecture according to the calling request information;
and the call execution module is used for executing the call of the target micro service in the current micro service architecture according to the virtual request information.
7. The calling device according to claim 6, wherein the generating virtual request information corresponding to a current micro service architecture according to the call request information comprises:
and converting the calling request information according to the architecture information of the micro service architecture to which the micro service calling party belongs and a preset information conversion method between the micro service architectures to generate virtual request information corresponding to the current micro service architecture.
8. The calling device according to claim 7, wherein the converting the call request information according to an information conversion method between preset micro service architectures, and generating the virtual request information corresponding to the current micro service architecture comprises:
and carrying out protocol conversion on the calling request information according to a preset protocol conversion method between the micro service architectures to generate virtual request information corresponding to the protocol supported by the current micro service architecture.
9. An electronic device, characterized in that the electronic device comprises:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: executing the microservice calling method according to any of claims 1 to 5.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the microservice calling method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011044279.5A CN112214334A (en) | 2020-09-28 | 2020-09-28 | Micro-service calling method and device, electronic equipment and computer-readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011044279.5A CN112214334A (en) | 2020-09-28 | 2020-09-28 | Micro-service calling method and device, electronic equipment and computer-readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112214334A true CN112214334A (en) | 2021-01-12 |
Family
ID=74051373
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011044279.5A Pending CN112214334A (en) | 2020-09-28 | 2020-09-28 | Micro-service calling method and device, electronic equipment and computer-readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112214334A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113037571A (en) * | 2021-05-20 | 2021-06-25 | 睿至科技集团有限公司 | Large-scale micro-service architecture and management method thereof |
CN113691635A (en) * | 2021-09-01 | 2021-11-23 | 中电金信软件有限公司 | Method and device for calling micro service, electronic equipment and readable storage medium |
CN113726869A (en) * | 2021-08-26 | 2021-11-30 | 阿里巴巴(中国)有限公司 | Communication method, gateway and electronic equipment |
CN114238178A (en) * | 2021-12-09 | 2022-03-25 | 零氪科技(北京)有限公司 | Calling method and device of micro-service architecture, electronic equipment and storage medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106453288A (en) * | 2016-09-29 | 2017-02-22 | 上海和付信息技术有限公司 | Asynchronous mode supporting distributed micro service framework system and implementation method thereof |
CN106533805A (en) * | 2016-12-23 | 2017-03-22 | 郑州云海信息技术有限公司 | Micro-service request processing method, micro-service controller and micro-service architecture |
CN106603583A (en) * | 2017-02-23 | 2017-04-26 | 北京工业大学 | Micro-service network building method |
CN109818980A (en) * | 2019-03-21 | 2019-05-28 | 中国铁塔股份有限公司 | A kind of communication means and device |
CN110138741A (en) * | 2019-04-15 | 2019-08-16 | 平安科技(深圳)有限公司 | Micro services management method, device and computer equipment based on management platform |
WO2019232961A1 (en) * | 2018-06-05 | 2019-12-12 | 平安科技(深圳)有限公司 | Interface automation method and system, computer device, and storage medium |
CN110995746A (en) * | 2019-12-17 | 2020-04-10 | 神州数码融信软件有限公司 | Micro-service calling method of heterogeneous network and API gateway |
-
2020
- 2020-09-28 CN CN202011044279.5A patent/CN112214334A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106453288A (en) * | 2016-09-29 | 2017-02-22 | 上海和付信息技术有限公司 | Asynchronous mode supporting distributed micro service framework system and implementation method thereof |
CN106533805A (en) * | 2016-12-23 | 2017-03-22 | 郑州云海信息技术有限公司 | Micro-service request processing method, micro-service controller and micro-service architecture |
CN106603583A (en) * | 2017-02-23 | 2017-04-26 | 北京工业大学 | Micro-service network building method |
WO2019232961A1 (en) * | 2018-06-05 | 2019-12-12 | 平安科技(深圳)有限公司 | Interface automation method and system, computer device, and storage medium |
CN109818980A (en) * | 2019-03-21 | 2019-05-28 | 中国铁塔股份有限公司 | A kind of communication means and device |
CN110138741A (en) * | 2019-04-15 | 2019-08-16 | 平安科技(深圳)有限公司 | Micro services management method, device and computer equipment based on management platform |
CN110995746A (en) * | 2019-12-17 | 2020-04-10 | 神州数码融信软件有限公司 | Micro-service calling method of heterogeneous network and API gateway |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113037571A (en) * | 2021-05-20 | 2021-06-25 | 睿至科技集团有限公司 | Large-scale micro-service architecture and management method thereof |
CN113726869A (en) * | 2021-08-26 | 2021-11-30 | 阿里巴巴(中国)有限公司 | Communication method, gateway and electronic equipment |
CN113691635A (en) * | 2021-09-01 | 2021-11-23 | 中电金信软件有限公司 | Method and device for calling micro service, electronic equipment and readable storage medium |
CN114238178A (en) * | 2021-12-09 | 2022-03-25 | 零氪科技(北京)有限公司 | Calling method and device of micro-service architecture, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112214334A (en) | Micro-service calling method and device, electronic equipment and computer-readable storage medium | |
CN108055248B (en) | Dubbo framework-based remote calling method, server and storage medium | |
US11210131B2 (en) | Method and apparatus for assigning computing task | |
JP7036826B2 (en) | Service processing method and equipment | |
CN109298926B (en) | Method and device for entering resource transfer party into resource transfer platform and electronic equipment | |
CN110399231B (en) | Cross-platform-based data processing method and device and computer equipment | |
CN110706093A (en) | Accounting processing method and device | |
CN112181378B (en) | Method and device for realizing business process | |
CN113076153A (en) | Interface calling method and device | |
TW201732587A (en) | Resource loading method, and service function implementing method and device for application (app) | |
CN112835632B (en) | Method and equipment for calling end capability and computer storage medium | |
CN111414154A (en) | Method and device for front-end development, electronic equipment and storage medium | |
CN111190750A (en) | Data processing method and system | |
CN113132400B (en) | Business processing method, device, computer system and storage medium | |
CN112905273A (en) | Service calling method and device | |
CN107395663B (en) | Data acquisition method and device | |
CN111176641A (en) | Flow node execution method, device, medium and electronic equipment | |
CN112579212A (en) | Cross-language calling method, calling party device and called party device | |
CN113760487B (en) | Service processing method and device | |
CN113835790B (en) | Paging page display method and device based on Android | |
CN110750271B (en) | Service aggregation, method and device for executing aggregated service and electronic equipment | |
CN112612625A (en) | Service calling method and device | |
CN111786965A (en) | RPC message processing method and device, electronic equipment and readable storage medium | |
CN114448703B (en) | Request processing method, request processing device, electronic equipment and storage medium | |
CN115470800A (en) | Robot conversation method and device |
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 |