CN113691635B - Method and device for calling microservice, electronic equipment and readable storage medium - Google Patents

Method and device for calling microservice, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN113691635B
CN113691635B CN202111021304.2A CN202111021304A CN113691635B CN 113691635 B CN113691635 B CN 113691635B CN 202111021304 A CN202111021304 A CN 202111021304A CN 113691635 B CN113691635 B CN 113691635B
Authority
CN
China
Prior art keywords
service
target
micro
calling
micro service
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
Application number
CN202111021304.2A
Other languages
Chinese (zh)
Other versions
CN113691635A (en
Inventor
李欢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongdian Jinxin Software Co Ltd
Original Assignee
Zhongdian Jinxin Software Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Zhongdian Jinxin Software Co Ltd filed Critical Zhongdian Jinxin Software Co Ltd
Priority to CN202111021304.2A priority Critical patent/CN113691635B/en
Publication of CN113691635A publication Critical patent/CN113691635A/en
Application granted granted Critical
Publication of CN113691635B publication Critical patent/CN113691635B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Computer And Data Communications (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a method, a device, an electronic device and a readable storage medium for calling a micro service, wherein a specific implementation mode of the method comprises the following steps: receiving a calling request for calling a target micro service; the calling request carries target information corresponding to the target micro service; searching at least one micro service matched with the target information in the constructed service directory; and determining the target microservice from the at least one microservice based on the communication protocol used by the at least one microservice, and completing the calling operation. The method can facilitate the developer to call the required target micro-service from other systems.

Description

Method and device for calling microservice, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of information processing, and in particular, to a method, an apparatus, an electronic device, and a readable storage medium for invoking a microservice.
Background
With the continuous development of informatization construction, the informatization application system architecture gradually changes from a traditional single architecture to a micro-service architecture. The microservice architecture may be embodied as a system that splits a business function into a number of independently deployed microservices, each providing a service function.
For a company, a plurality of systems are deployed simultaneously, and each system provides a plurality of micro services, so the number of the micro services is huge. For developers, only the distribution situation of each micro service in the system participating in development is known, and the distribution situation of the micro services in other systems is difficult to know; for example, when a system developed by a developer lacks the microservice a and the microservice a exists in another system, the developer cannot know the information and can only develop the information by himself, so that the developer cannot conveniently call the microservice in another system.
Disclosure of Invention
The embodiment of the application aims to provide a method, a device, an electronic device and a readable storage medium for calling a micro service, so as to call a required target micro service from other systems.
In a first aspect, an embodiment of the present application provides a method for invoking a microservice, including: receiving a calling request for calling a target micro service; the calling request carries target information corresponding to the target micro-service; searching at least one micro service matched with the target information in the constructed service directory; and determining the target microservice from the at least one microservice based on the communication protocol used by the at least one microservice, and completing the calling operation. Therefore, developers can call the required target micro-service conveniently without developing the target micro-service by themselves, and development pressure is relieved.
Optionally, the searching for at least one microservice matching the target information includes: when the target information is a service type, searching a target service type matched with the service type, and determining the at least one micro service based on the target service type; and matching the target micro service according to the third identity information when the target information is the third identity information of the target micro service. Two modes capable of being used for determining the target micro service are provided, and in a specific application scene, the target micro service can be determined according to the information content corresponding to the target information, so that various calling options are provided for developers.
Optionally, the determining a target microservice from the at least one microservice based on the communication protocol used by the at least one microservice includes: and when the communication protocols respectively corresponding to the at least one micro service are consistent with the communication protocol of the system requesting to call the target micro service, taking the micro service with the consistent communication protocol as the target micro service. Therefore, the target micro-service capable of being directly called can be determined, and the developer can call the target micro-service to complete the development work of the system.
Optionally, the determining, based on a communication protocol used by the at least one microservice, the target microservice from the at least one microservice, and completing a call operation includes: and when the communication protocols respectively corresponding to the at least one micro service do not exist and are consistent with the communication protocol of the system requesting to call the target micro service, selecting the micro service with the latest version from the at least one micro service, converting the communication protocol of the system where the micro service is located into the communication protocol of the system calling the target micro service, and finishing the calling operation. Thus, even if the communication protocol of the target micro-service requested to be called is not consistent with the communication protocol used by the system requesting to call the target micro-service, the target micro-service can be called, and the development work of the system can be completed.
Optionally, the service directory is constructed in advance based on the following steps: respectively acquiring micro-service information of at least one micro-service in each system; the micro service information comprises first identity information of a providing system where the micro service is located, second identity information of a calling system applying for calling the micro service, third identity information corresponding to the micro service and a service type corresponding to the micro service; and establishing an association relation among the first identity information, the second identity information, the third identity information and the service type according to an affiliation relation between the micro service and the providing system and a calling relation between the micro service and the calling system to obtain the service directory. Therefore, no matter the target information is the third identity information or the service type, other information can be searched through the established association relation, and the target micro service is determined.
Optionally, the method for invoking a microservice further includes: when a viewing request for viewing the called condition of the micro service is received, according to third identity information corresponding to the micro service to be viewed, second identity information related to the third identity information is searched; determining a calling system applying for calling the checked microservice according to the second identity information; and when the calling system applying for calling the viewed micro-service completes the data interaction operation with the viewed micro-service, determining that the called condition of the viewed micro-service is successful calling. Therefore, developers can conveniently check the calling condition of the micro-service, and can master the calling condition in real time to manage the micro-service.
Optionally, the determining the target microservice and completing a calling operation includes: and when receiving the update information of the providing system to the target micro service, updating the target micro service according to the update information, and completing calling operation by using the target micro service after the update operation is completed. Thus, the target micro-service can be updated, and all the target micro-services called by the developers are the latest target micro-services.
In a second aspect, an embodiment of the present application provides an apparatus for invoking a microservice, where the apparatus includes: the receiving module is used for receiving a calling request for calling the target micro service; the calling request carries target information corresponding to the target micro-service; the searching module is used for searching at least one micro service matched with the target information in the constructed service directory; and the calling module is used for determining the target microservice from the at least one microservice based on the communication protocol used by the at least one microservice and finishing calling operation.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, where the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method as provided in the first aspect are executed.
In a fourth aspect, embodiments of the present application provide a readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, performs the steps in the method as provided in the first aspect.
Additional features and advantages of the present application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the present application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
FIG. 1 is a flowchart of a method for invoking micro-services according to an embodiment of the present disclosure;
FIG. 2 is a block diagram illustrating an apparatus for invoking microservices according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an electronic device for executing a method for invoking a microservice according to an embodiment of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as presented in the figures, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined or explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not construed as indicating or implying relative importance.
It should be noted that, in the present application, embodiments or technical features in the embodiments may be combined without conflict.
In the related art, the problem that micro-services in other systems cannot be conveniently called exists; in order to solve the problem, the application provides a method, a device, an electronic device and a readable storage medium for calling a micro service; further, the method can maintain information such as communication protocols, use requirements, update conditions and the like of a plurality of micro services in the service directory by constructing the service directory in advance, can search relevant information of the target micro service in the constructed service directory when receiving a query request of the target micro service, and can complete calling operation of the target micro service according to needs, thereby solving the technical problem. In practice, the method for invoking the micro service may be applied to a server or a terminal device. Illustratively, the present application specifically describes the method for invoking the microservice by taking an application to a server as an example.
The above-mentioned drawbacks of the solutions in the related art are all the results of the inventor after practice and careful study, so that the discovery process of the above-mentioned problems and the solutions proposed by the following embodiments of the present invention to the above-mentioned problems should be the contribution of the inventor to the present invention in the process of the present invention.
Referring to fig. 1, a flowchart of a method for invoking a microservice according to an embodiment of the present application is shown. As shown in fig. 1, the method for invoking a microservice may be applied to a server, and specifically may include the following steps 101 to 103.
Step 101, receiving a calling request for calling a target micro service; the calling request carries target information corresponding to the target micro-service;
in some application scenarios, a user may send a call request through a terminal device corresponding to the user, and a server may receive the call request sent by the terminal device. The call request may include target information corresponding to a target micro service to be called. In these application scenarios, the target information may include information that substantially indicates the identity of the target microservice, such as the domain to which the target microservice belongs, the usage, the identity code, and the like.
Step 102, searching at least one micro service matched with the target information in the constructed service directory;
after receiving the call request, the server may search for the corresponding at least one microservice according to the target information. For example, after receiving target information indicating a purpose of a target microservice, the server may look up all microservices having the purpose in the constructed service directory. For example, when the call request carries target information representing that the purpose is "management", micro-services such as authority management and log management can be found.
Step 103, determining the target microservice from the at least one microservice based on the communication protocol used by the at least one microservice, and completing the calling operation.
In some application scenarios, each microservice may transmit data via its corresponding communication protocol. After the server determines a plurality of micro services matching the target information, the communication protocol used by each micro service may be further determined.
In these application scenarios, for example, a target communication protocol used by the system requesting invocation of the target microservice may be determined. In this way, the microservices that also used the target communication protocol can be determined. The microservice may then be determined to make the call to the target microservice.
In this embodiment, through the steps 101 to 103, developers can call target micro services required by themselves conveniently without developing themselves, thereby reducing development pressure.
In some optional implementations, the searching for at least one microservice matching the target information in step 102 may include the following sub-steps:
substep 1021, when the target information is a service type, searching a target service type matched with the service type, and determining the at least one micro service based on the target service type;
in some application scenarios, if the target information is detected as a service category, a target service category matching the service category may be searched. For example, if it is detected that the target information is a service type capable of realizing the logistics operation, the logistics type matched with the target information can be found, and a plurality of micro services belonging to the logistics type, such as code scanning sending, courier telephone number checking and the like, can be determined based on the logistics type. In these application scenarios, for example, one of the plurality of micro services may be selected as a target micro service for invocation according to the selection operation.
And a substep 1022, when the target information is third identity information of the target micro service, matching the target micro service according to the third identity information.
In some application scenarios, if it is detected that the target information is third identity information of the target micro service, the corresponding target micro service may be determined according to the third identity information. The third identity information may include, for example, an identity identification code, an identity number, and other information that can be used to substantially uniquely characterize the identity of the target microservice. For example, when the target information is detected to be the third identity information "01", the corresponding "user management" microservice may be matched according to "01".
Sub-step 1021 and sub-step 1022 respectively provide a manner capable of determining a target micro service, and in a specific application scenario, the target micro service may be determined according to information content corresponding to target information, and multiple calling options are provided for a developer (that is, the developer may make the target information carried in a calling request be service type or third identity information of the target micro service, and can complete a calling operation).
In some optional implementation manners, the determining, in the step 103, the target microservice from the at least one microservice based on the communication protocol used by the at least one microservice includes: and when the communication protocols respectively corresponding to the at least one micro service are consistent with the communication protocol of the system requesting to call the target micro service, taking the micro service with the consistent communication protocol as the target micro service.
After the server finds the multiple micro services, whether the communication protocols corresponding to the found multiple micro services are consistent with the communication protocol of the system requesting to call the target micro service can be judged, and if so, the micro services with the consistent communication protocols can be determined as the target micro service. For example, when the communication protocol of the system requesting to invoke the target micro service is a transmission control protocol (TCP protocol for short), if there is a micro service a using the TCP protocol in the found micro service, the micro service a may be determined as the target micro service. After the target microservice is determined, a call operation may be performed.
Therefore, the target micro-service capable of being directly called can be determined, and the developer can call the target micro-service to complete the development work of the system.
In some application scenarios, if there are multiple micro services with the same communication protocol, all of the multiple micro services may be determined as target micro services. Further, the developer may select one or more of the plurality of microservices for invocation as desired.
In some optional implementations, the determining, based on a communication protocol used by the at least one microservice, the target microservice from the at least one microservice, and completing a call operation includes: and when the communication protocols respectively corresponding to the at least one micro service do not exist and are consistent with the communication protocol of the system requesting to call the target micro service, selecting the micro service with the latest version from the at least one micro service, converting the communication protocol of the system where the micro service is located into the communication protocol of the system calling the target micro service, and finishing the calling operation.
In some application scenarios, after finding a plurality of micro services, if it is detected that the communication protocols used by the micro services are all inconsistent with the communication protocol used by the system requesting to invoke the target micro service, the server may determine the micro service with the latest version among the found micro services as the target micro service, and convert the communication protocol used by the micro service with the latest version into a communication protocol consistent with the communication protocol of the system requesting to invoke the target micro service, so as to implement the invoking operation. In these application scenarios, the technology for converting the communication protocol (e.g., using a protocol converter) is well known to those skilled in the art, and is not described herein.
Thus, even if the communication protocol of the target micro-service requested to be called is not consistent with the communication protocol used by the system requesting to call the target micro-service, the target micro-service can be called, and the development work of the system can be completed.
In some optional implementations, the service directory is constructed in advance based on the following steps:
step 1, respectively acquiring micro-service information of at least one micro-service in each system; the micro service information comprises first identity information of a providing system where the micro service is located, second identity information of a calling system applying for calling the micro service, third identity information corresponding to the micro service and a service type corresponding to the micro service;
the first identity information may include, for example, information substantially uniquely characterizing the identity of the providing system, such as an identity code, an identity number, and the like; the second identity information may include, for example, information such as an identity code, an identity number, and the like, which is substantially used to uniquely characterize the identity of the calling system.
When the service directory is constructed, the first identity information and the second identity information can use the same identification mode, so that the service directory can maintain the identity information uniformly. That is, the corresponding identities may each be represented by an identity code or an identity number.
In some application scenarios, the service side may build the service directory in advance. When the server is constructed, the server can acquire information of a plurality of systems. Specifically, for each micro service, micro service information of the micro service may be acquired. In these application scenarios, at least the first identity information of the providing system for developing the micro service, the second identity information of the calling system for applying for calling the micro service, the third identity information corresponding to the micro service, and the service type may be obtained.
And 2, establishing an association relationship among the first identity information, the second identity information, the third identity information and the service type according to an affiliation relationship between the micro service and the providing system and a calling relationship between the micro service and the calling system to obtain the service directory.
After acquiring the micro-service information of each micro-service, a service directory can be constructed according to the affiliation between the micro-service and the providing system and the calling relationship between the micro-service and the calling system. Specifically, the first identity information of the providing system, the third identity information corresponding to the micro service and the service type can be stored in an associated manner according to the affiliation; storing the second identity information of the calling system, third identity information corresponding to the micro service and the service type in an associated manner according to the calling relation;
therefore, no matter the target information is the third identity information or the service type, other information can be searched through the established association relation, and the target micro service is determined.
In some optional implementations, the method of invoking a microservice may further include the steps of:
104, when a checking request for checking the called condition of the micro service is received, searching second identity information related to third identity information according to the third identity information corresponding to the checked micro service;
in some application scenarios, the server may receive a viewing request for requesting to view a condition that the micro service is invoked, and when receiving the viewing request, may determine third identity information of the viewed micro service. Further, according to the determined third identity information, second identity information associated with the third identity information can be determined according to the association relation stored in the service directory.
Step 105, determining a calling system applying for calling the checked microservice according to the second identity information;
after the second identity information is determined, a calling system corresponding to the second identity information can be determined. For example, the second identity information is "02", and it can be determined that the system corresponding to "02" is the a system, and the a system is a calling system that applies for calling the viewed microservice.
And 106, when the calling system applying for calling the viewed micro-service completes the data interaction operation with the viewed micro-service, determining that the called condition of the viewed micro-service is successfully called.
After the calling system is determined, it may be determined whether the calling system completes the data interaction operation with the viewed microservice, and if so, it may be determined that the viewed microservice is successfully called by the calling system. The data interaction operation may include, for example, an operation capable of actually generating interaction data. For example, after system A calls viewed microservice a, if viewed microservice a produces data in cooperation with other microservices in system A, the data interaction operation can be considered to be completed.
Through the steps 104 to 106, developers can conveniently check the calling condition of the micro-service, so that the developers can master the calling condition in real time to manage the micro-service.
In some optional implementations, the determining of the target microservice in step 103 and completing a call operation include: and when receiving the update information of the providing system to the target micro service, updating the target micro service according to the update information, and completing calling operation by using the target micro service after the update operation is completed.
In some application scenarios, the server may update the target microservice. Specifically, the server may update the target microservice according to the update information when receiving the update information of the providing system to the target microservice. For example, when receiving the update information sent by the provisioning system to replace interface B of the target micro service with interface C, an update operation to update interface B of the target micro service to interface C may be performed.
After the update operation is completed, the updated target microservice may be called to complete the call operation. Thus, the target micro-service can be updated, and all the target micro-services called by the developers are the latest target micro-services.
In other application scenarios, after the calling system completes the calling, the calling system may send feedback information indicating whether the calling is successful to the server, and the server may store the calling condition information of the target microservice according to the feedback information. For example, when receiving the update information sent by the calling system that the target microservice has been put into actual use (e.g., the data interaction operation has been completed), the call state information of the target microservice may be updated, so that the developer knows the actual call state of the target microservice.
Referring to fig. 2, a block diagram of an apparatus for invoking a microservice according to an embodiment of the present application is shown, where the apparatus for invoking a microservice may be a module, a program segment, or code on an electronic device. It should be understood that the apparatus corresponds to the above-mentioned embodiment of the method in fig. 1, and can perform various steps related to the embodiment of the method in fig. 1, and the specific functions of the apparatus can be referred to the above description, and the detailed description is appropriately omitted here to avoid redundancy.
Optionally, the apparatus for invoking a microservice includes a receiving module 201, a searching module 202, and an invoking module 203. The receiving module 201 is configured to receive a call request for calling a target microservice; the calling request carries target information corresponding to the target micro service; a searching module 202, configured to search at least one microservice matching the target information in the constructed service directory; the invoking module 203 is configured to determine the target microservice from the at least one microservice based on a communication protocol used by the at least one microservice, and complete an invoking operation.
Optionally, the lookup module 202 is further configured to: when the target information is a service type, searching a target service type matched with the service type, and determining the at least one micro service based on the target service type; and matching the target micro service according to the third identity information when the target information is the third identity information of the target micro service.
Optionally, the invoking module 203 is further configured to: and when the communication protocols respectively corresponding to the at least one micro service are consistent with the communication protocol of the system requesting to call the target micro service, taking the micro service with the consistent communication protocol as the target micro service.
Optionally, the invoking module 203 is further configured to: and when the communication protocols respectively corresponding to the at least one micro service do not exist and are consistent with the communication protocol of the system requesting to call the target micro service, selecting the micro service with the latest version from the at least one micro service, converting the communication protocol of the system where the micro service is located into the communication protocol of the system calling the target micro service, and finishing the calling operation.
Optionally, the service directory is constructed in advance based on the following steps: respectively acquiring micro-service information of at least one micro-service in each system; the micro service information comprises first identity information of a providing system where the micro service is located, second identity information of a calling system applying for calling the micro service, third identity information corresponding to the micro service and a service type corresponding to the micro service; and establishing an association relation among the first identity information, the second identity information, the third identity information and the service type according to an affiliation relation between the micro service and the providing system and a calling relation between the micro service and the calling system to obtain the service directory.
Optionally, the apparatus for invoking a microservice further includes a determining module, where the determining module is configured to: when a viewing request for viewing the called condition of the micro service is received, second identity information related to third identity information is searched according to the third identity information corresponding to the micro service to be viewed; determining a calling system applying for calling the checked microservice according to the second identity information; and when the calling system applying for calling the viewed micro-service completes the data interaction operation with the viewed micro-service, determining that the called condition of the viewed micro-service is successful calling.
Optionally, the invoking module 203 is further configured to: and when receiving the update information of the providing system to the target micro service, updating the target micro service according to the update information, and completing calling operation by using the target micro service after the update operation is completed.
It should be noted that, for the convenience and simplicity of description, the specific working process of the above-described device may refer to the corresponding process in the foregoing method embodiment, and the description is not repeated here.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an electronic device for executing a method for invoking a microservice according to an embodiment of the present application, where the electronic device may include: at least one processor 301, e.g., a CPU, at least one communication interface 302, at least one memory 303 and at least one communication bus 304. Wherein the communication bus 304 is used for realizing direct connection communication of the components. The communication interface 302 of the device in this embodiment is used for performing signaling or data communication with other node devices. The memory 303 may be a high-speed RAM memory or a non-volatile memory (e.g., at least one disk memory). The memory 303 may optionally be at least one memory device located remotely from the aforementioned processor. The memory 303 stores computer readable instructions, and when the computer readable instructions are executed by the processor 301, the electronic device may execute the method process shown in fig. 1.
It will be appreciated that the configuration shown in fig. 3 is merely illustrative and that the electronic device may include more or fewer components than shown in fig. 3 or may have a different configuration than shown in fig. 3. The components shown in fig. 3 may be implemented in hardware, software, or a combination thereof.
Embodiments of the present application provide a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program may perform the method processes performed by an electronic device in the method embodiment shown in fig. 1.
The present embodiment discloses a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the method provided by the above method embodiments, for example, the method may comprise: receiving a calling request for calling a target micro service; the calling request carries target information corresponding to the target micro-service; searching at least one micro service matched with the target information in the constructed service directory; and determining the target microservice from the at least one microservice based on the communication protocol used by the at least one microservice, and completing the calling operation.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described apparatus embodiments are merely illustrative, and for example, the division of the units into only one type of logical function may be implemented in other ways, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (9)

1. A method of invoking a microservice, the method comprising:
receiving a calling request for calling a target micro service; the calling request carries target information corresponding to the target micro-service;
searching at least one micro service matched with the target information in the constructed service directory;
determining the target microservice from the at least one microservice based on a communication protocol used by the at least one microservice, and completing a calling operation;
the service directory is constructed in advance based on the following steps:
respectively acquiring micro-service information of at least one micro-service in each system; the micro service information comprises first identity information of a providing system where the micro service is located, second identity information of a calling system applying for calling the micro service, third identity information corresponding to the micro service and a service type corresponding to the micro service;
and establishing an association relation among the first identity information, the second identity information, the third identity information and the service type according to an affiliation relation between the micro service and the providing system and a calling relation between the micro service and the calling system to obtain the service directory.
2. The method of claim 1, wherein the searching for at least one microservice matching the target information comprises:
when the target information is a service type, searching a target service type matched with the service type, and determining the at least one micro service based on the target service type;
and matching the target micro service according to the third identity information when the target information is the third identity information of the target micro service.
3. The method of claim 1, wherein the determining the target microservice from the at least one microservice based on the communication protocol used by the at least one microservice comprises:
and when the communication protocols respectively corresponding to the at least one micro service are consistent with the communication protocol of the system requesting to call the target micro service, taking the micro service with the consistent communication protocol as the target micro service.
4. The method of claim 1, wherein the determining the target microservice from the at least one microservice based on the communication protocol used by the at least one microservice and completing the invoking comprises:
and when the communication protocol corresponding to the at least one micro service does not exist and is consistent with the communication protocol of the system requesting to call the target micro service, selecting the micro service with the latest version from the at least one micro service, converting the communication protocol of the system where the micro service is located into the communication protocol of the system calling the target micro service, and finishing the calling operation.
5. The method of claim 1, further comprising:
when a viewing request for viewing the called condition of the micro service is received, second identity information related to third identity information is searched according to the third identity information corresponding to the micro service to be viewed;
determining a calling system applying for calling the checked micro-service according to the second identity information;
and when the calling system applying for calling the checked micro service completes the data interaction operation with the checked micro service, determining that the called condition of the checked micro service is successful calling.
6. The method of claim 1, wherein said determining the target microservice and completing the invocation comprises:
and when receiving the update information of the providing system to the target micro service, updating the target micro service according to the update information, and completing calling operation by using the target micro service after the update operation is completed.
7. An apparatus for invoking microservices, the apparatus comprising:
the receiving module is used for receiving a calling request for calling the target micro service; the calling request carries target information corresponding to the target micro-service;
the searching module is used for searching at least one micro service matched with the target information in the constructed service directory;
the calling module is used for determining the target microservice from the at least one microservice based on the communication protocol used by the at least one microservice and finishing calling operation;
the service directory is constructed in advance based on the following steps:
respectively acquiring micro-service information of at least one micro-service in each system; the micro service information comprises first identity information of a providing system where the micro service is located, second identity information of a calling system applying for calling the micro service, third identity information corresponding to the micro service and a service type corresponding to the micro service;
and establishing an association relation among the first identity information, the second identity information, the third identity information and the service type according to an affiliation relation between the micro service and the providing system and a calling relation between the micro service and the calling system to obtain the service directory.
8. An electronic device comprising a processor and a memory, the memory storing computer readable instructions that, when executed by the processor, perform the method of any of claims 1-6.
9. A readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN202111021304.2A 2021-09-01 2021-09-01 Method and device for calling microservice, electronic equipment and readable storage medium Active CN113691635B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111021304.2A CN113691635B (en) 2021-09-01 2021-09-01 Method and device for calling microservice, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111021304.2A CN113691635B (en) 2021-09-01 2021-09-01 Method and device for calling microservice, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN113691635A CN113691635A (en) 2021-11-23
CN113691635B true CN113691635B (en) 2022-08-19

Family

ID=78584791

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111021304.2A Active CN113691635B (en) 2021-09-01 2021-09-01 Method and device for calling microservice, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN113691635B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115086048B (en) * 2022-06-20 2023-12-15 中电金信软件有限公司 Data processing method, device, electronic equipment and readable storage medium
CN114942856B (en) * 2022-07-22 2022-11-04 浙江中控技术股份有限公司 Data processing method and device of micro-service system and electronic equipment
CN115580648B (en) * 2022-09-30 2023-07-25 北京大数据先进技术研究院 Data fusion system design method, system, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109246251A (en) * 2018-11-13 2019-01-18 杭州数梦工场科技有限公司 A kind of micro services call method, device, system, equipment and readable storage medium storing program for executing
CN111767095A (en) * 2020-06-30 2020-10-13 平安国际智慧城市科技股份有限公司 Micro-service generation method and device, terminal equipment and storage medium
CN112612595A (en) * 2020-12-29 2021-04-06 太平金融科技服务(上海)有限公司 Method and device for establishing micro-service calling relationship, computer equipment and storage medium
CN113301166A (en) * 2021-06-16 2021-08-24 杭州华橙软件技术有限公司 Service calling method and device, storage medium and electronic device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109582471A (en) * 2017-09-29 2019-04-05 西门子公司 Information processing method, device and system
CN112214334A (en) * 2020-09-28 2021-01-12 亚信科技(中国)有限公司 Micro-service calling method and device, electronic equipment and computer-readable storage medium
CN112491948B (en) * 2020-10-12 2024-05-24 大家信科有限责任公司 Non-invasive monomer application micro-service method, device and computer equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109246251A (en) * 2018-11-13 2019-01-18 杭州数梦工场科技有限公司 A kind of micro services call method, device, system, equipment and readable storage medium storing program for executing
CN111767095A (en) * 2020-06-30 2020-10-13 平安国际智慧城市科技股份有限公司 Micro-service generation method and device, terminal equipment and storage medium
CN112612595A (en) * 2020-12-29 2021-04-06 太平金融科技服务(上海)有限公司 Method and device for establishing micro-service calling relationship, computer equipment and storage medium
CN113301166A (en) * 2021-06-16 2021-08-24 杭州华橙软件技术有限公司 Service calling method and device, storage medium and electronic device

Also Published As

Publication number Publication date
CN113691635A (en) 2021-11-23

Similar Documents

Publication Publication Date Title
CN113691635B (en) Method and device for calling microservice, electronic equipment and readable storage medium
CN108510389B (en) Intelligent contract calling method and device based on block chain and readable storage medium
CN110311983B (en) Service request processing method, device and system, electronic equipment and storage medium
US7831734B2 (en) Method and system for remote configuration of network devices
CN110119292B (en) System operation parameter query method, matching method, device and node equipment
CN110557433A (en) Resource management method, platform, cloud gateway, system and storage medium
CN112422709A (en) Identification management method, terminal device, identification resolution secondary node and medium
CN111858083A (en) Remote service calling method and device, electronic equipment and storage medium
CN111491037A (en) Communication method with object storage server through SFTP data stream
CN112217845B (en) Data transmission method based on Netconf protocol and related equipment
CN115562757A (en) Data processing method, configuration center system, electronic device, and storage medium
CN110933188A (en) Remote service calling method, system, server and storage medium
CN110798358B (en) Distributed service identification method and device, computer readable medium and electronic equipment
CN117119078A (en) Privacy task scheduling method and device based on Kubernetes cluster interconnection scheduling framework
CN111327680B (en) Authentication data synchronization method, device, system, computer equipment and storage medium
CN112698930A (en) Method, device, equipment and medium for obtaining server identification
CN115390939B (en) Service processing method and system
CN112448909A (en) Electronic lock management method, device, system and storage medium
CN114221971B (en) Data synchronization method, device, server, storage medium and product
CN113434190B (en) Data processing method and device, storage medium and electronic equipment
CN115277707A (en) Service processing method, device, electronic equipment and storage medium
CN108900575B (en) Long connection hierarchical communication method and system based on mobile terminal
US20080027944A1 (en) Globally unique instance identification
US7100171B1 (en) System and method for auto-evolvable remote procedure call structures
CN117472617B (en) Message processing method and device, electronic equipment and readable storage medium

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