A method and device for generating a service catalog of microservices

By scanning the service registration center to obtain the address information of the microservice instance and generate a service catalog, the problems of complex microservice application reuse methods and difficulty in reuse between different development language frameworks are solved, and convenient microservice application reuse is achieved.

CN115623060BActive Publication Date: 2025-09-16GUANGDONG ELECTRIC POWER COMM CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211248500.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-12
Publication Date
2025-09-16
Estimated Expiration
2042-10-12

AI Technical Summary

Technical Problem

The existing microservice application reuse method has the problems of complex use and difficulty in reuse between different development languages ​​and development frameworks.

Method used

By scanning the service registry in the cluster, the address information of the microservice instance and the application interface information are obtained, and then standardized to generate a service catalog.

Benefits of technology

It provides a convenient way to reuse microservice applications, solves the isolation problem between different development languages ​​and development frameworks, and improves usage efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115623060B_ABST
    Figure CN115623060B_ABST
Patent Text Reader

Abstract

The present application provides a method and apparatus for generating a service catalog for microservices, wherein the method comprises: obtaining address information of microservice instances in a service registry by scanning a service registry in a cluster; sending an access request to the microservice instance based on the address information of the microservice instance to obtain information about the application program interface (API) of the microservice instance; standardizing the API information to obtain standardized API information; and generating a service catalog based on the standardized API information. This application solves the technical problems of the prior art in the complex use of microservice application reuse methods and the difficulty of reuse between different development languages ​​and development frameworks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and device for generating a service catalog for microservices. Background Art

[0002] Microservices (or microservices architecture) are a cloud-native architectural approach in which a single application is composed of many loosely coupled, independently deployable smaller components or services. With the rapid development of digital enterprise businesses, a large number of microservice applications have been developed and deployed within enterprises. Some of these microservice applications are highly reusable, meaning they are repeatedly applied in multiple fields, resulting in some microservice applications being repeatedly developed by multiple enterprises. The existing method for reusing microservice applications is to package the microservice applications into development toolkits, upload them to a tool library, and then users can reference them according to their needs when developing new products. Existing methods for reusing microservice applications have two technical issues: First, the usage is complex. Service providers not only need to package the functional code but also provide complete interface documentation. Users need to review a large amount of toolkit interface documentation before reusing them to obtain the desired information. Second, it is difficult to reuse functions between different development languages ​​and development frameworks. That is, the method of reusing microservice applications in the existing technology has technical problems such as complex usage methods and difficulty in reuse between different development languages ​​and development frameworks. The present application provides a method and device for generating a service directory for microservices, which can realize the reuse of microservice applications while being convenient to use and eliminating isolation between different development languages ​​and development frameworks. Summary of the Invention

[0003] The purpose of the present application is to provide a method and apparatus for generating a microservice service catalog, which solves the technical problems of the existing microservice application reuse methods, such as the complexity of usage and the difficulty of reuse between different development languages ​​and development frameworks. The specific technical solution is as follows:

[0004] In the first aspect of the implementation of the present application, a method for generating a service catalog of a microservice is first provided, the method comprising: obtaining address information of a microservice instance of a service registration center by scanning a service registration center in a cluster; sending an access request to the microservice instance based on the address information of the microservice instance to obtain information about an application program interface of the microservice instance; standardizing the information about the application program interface to obtain information about a standardized application program interface; and generating a service catalog based on the information about the standardized application program interface.

[0005] In the second aspect of the implementation of the present application, a service catalog generation device for microservices is also provided, and the device includes: a first processing module, which is used to obtain the address information of the microservice instance of the service registration center by scanning the service registration center in the cluster; a second processing module, which is used to send an access request to the microservice instance based on the address information of the microservice instance to obtain the application interface information of the microservice instance; a third processing module, which is used to standardize the information of the application interface to obtain the information of the standardized application interface; and a generation module, which is used to generate a service catalog based on the information of the standardized application interface.

[0006] In the third aspect of the implementation of the present application, an electronic device is also provided, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the method steps described in the first aspect when executing the program stored in the memory.

[0007] In a fourth aspect of the implementation of the present application, a computer-readable storage medium is further provided, wherein instructions are stored in the computer-readable storage medium. When the computer-readable storage medium is run on a computer, the computer executes the service catalog generation method for microservices described in the first aspect above.

[0008] The service catalog generation method and device for microservices provided in the embodiments of the present application obtain the address information of the microservice instance of the service registration center by scanning the service registration center in the cluster; based on the address information of the microservice instance, send an access request to the microservice instance to obtain the application interface information of the microservice instance; standardize the application interface information to obtain standardized application interface information; generate a service catalog based on the standardized application interface information; that is, a service catalog is formed for the developed microservices through the service registration center, and the existing microservices are provided, thereby solving the technical problems in the prior art of complex usage methods of microservice application reuse methods and difficulty in reuse between different development languages ​​​​and development frameworks. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art.

[0010] Figure 1 This is one of the flow charts of the method for generating a service catalog for microservices in an embodiment of the present application;

[0011] Figure 2 This is the second flow chart of the method for generating a service catalog for microservices in an embodiment of the present application;

[0012] Figure 3 This is the third flow chart of the method for generating a service catalog for microservices in an embodiment of this application;

[0013] Figure 4 This is the fourth flow chart of the method for generating a service catalog for microservices in an embodiment of the present application;

[0014] Figure 5 This is the fifth flow chart of the method for generating a service catalog for microservices in an embodiment of the present application;

[0015] Figure 6 This is the sixth flow chart of the method for generating a service catalog for microservices in an embodiment of the present application;

[0016] Figure 7 This is a flowchart of an exemplary method for generating a service catalog for microservices in an embodiment of the present application;

[0017] Figure 8 This is one of the structural diagrams of the service catalog generation device for microservices in an embodiment of the present application;

[0018] Figure 9 This is the second structural diagram of the device for generating a service catalog for microservices in an embodiment of the present application;

[0019] Figure 10 This is the third structural diagram of the device for generating a service catalog for microservices in an embodiment of the present application;

[0020] Figure 11 This is the fourth structural diagram of the device for generating a service catalog for microservices in an embodiment of the present application;

[0021] Figure 12 This is the fifth structural diagram of the device for generating a service catalog for microservices in an embodiment of the present application;

[0022] Figure 13 This is the sixth structural diagram of the device for generating a service catalog for microservices in an embodiment of the present application;

[0023] Figure 14 This is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0024] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0025] In the following description, the suffixes such as "module" and "unit" used to represent elements are only used to facilitate the description of this application and have no specific meaning. Therefore, "module" and "component" can be used interchangeably.

[0026] The following will describe the technical solution in the embodiment of the present application in conjunction with the accompanying drawings. The embodiment of the present application provides a method for generating a service catalog of a microservice, such as Figure 1 As shown, the method includes the following steps:

[0027] Step 102: Scan the service registry in the cluster to obtain the address information of the microservice instance in the service registry;

[0028] Among them, it should be noted that the cluster consists of a group of independent computers interconnected by a high-speed network, and the cluster manages the computers through a single system mode; the purpose of configuring the cluster is to improve availability and scalability; the service registry is used to provide an address list of microservice instances in the cluster; microservice is a cloud-native architecture approach, in which a single application consists of many loosely coupled and independently deployable smaller components or services. A microservice is a small and independent processing process that can be started or destroyed independently and has an independent database; a microservice instance is a specific microservice; the cluster includes at least one service registry and an application programming interface (API) gateway; when two independent local area networks communicate through a router, the intermediate router is called a gateway; before obtaining the address information of the microservice instance from the service registry, it also includes: when the microservice instance registers in the service registry, the address information of the microservice instance is sent to the service registry, so that the service registry saves the address information of the microservice instance to the address list of the database.

[0029] Step 104: Based on the address information of the microservice instance, send an access request to the microservice instance to obtain information about the application program interface of the microservice instance;

[0030] Among them, it should be noted that the API gateway is used to obtain the API information of the microservice instance. The microservice instance has the function of sending API information to the API gateway, processing the request information sent by the API gateway and responding.

[0031] Step 106: Standardize the application program interface information to obtain standardized application program interface information;

[0032] It should be noted that standardization processing includes screening, grouping, organizing, formatting and integrating API information.

[0033] Step 108: Generate a service catalog based on the information of the standardized application program interface.

[0034] It should be noted that, in one example, the microservice instance obtains API information through the swagger component, and filters, groups, organizes and formats the API according to the Representational State Transfer (RESTful) style; swagger is a standardized and complete framework for generating, describing, calling and visualizing RESTful-style Web services; RESTful refers to a design style and development method for network applications, which is suitable for scenarios where mobile Internet manufacturers use it as a business interface, enabling third-party Internet companies to call mobile network resources over operators (Over The Top, abbreviated as OTT), and the action types are adding, changing and deleting the called resources.

[0035] Through the above steps 102 to 108 of the embodiment of the present application, the service registration center in the cluster is scanned to obtain the address information of the microservice instance of the service registration center; based on the address information of the microservice instance, an access request is sent to the microservice instance to obtain the application interface information of the microservice instance; the application interface information is standardized to obtain the standardized application interface information; a service directory is generated based on the standardized application interface information; that is, a service directory is formed for the developed microservices through the service registration center, and the existing microservices are provided, thereby solving the technical problems of the microservice application reuse method in the prior art, such as the complex usage method and the difficulty in reuse between different development languages ​​and development frameworks.

[0036] In an optional implementation of the embodiment of the present application, the information generation service catalog based on the standardized application program interface involved in step 108 of the present application is as follows: Figure 2 Shown, including:

[0037] Step 202: Save the standardized application program interface information to the application program interface list; wherein the standardized application program interface information includes the standardized application program interface address information, the standardized application program interface interface description information, the standardized application program interface request parameters, and the standardized application program interface response information;

[0038] Step 204: Output the address information of the standardized application program interface to a unified global wide area network page to generate a service directory.

[0039] Among them, it should be noted that the unified global wide area network (Web) page is the user-facing visual interface of the service directory, and users can search, debug and call APIs through the Web page.

[0040] It can be seen that the service catalog generation method for microservices provided in the embodiment of the present application can provide users with a web page for retrieval, debugging and calling, which is easy to use and there is no isolation between different development languages ​​​​and development frameworks.

[0041] The method for generating a service catalog of a microservice provided in the embodiment of the present application is as follows: Figure 3 As shown, after step 204 involves outputting the address information of the standardized application program interface to a unified global wide area network page and generating a service directory, the following steps are included:

[0042] Step 302: Obtain a search request sent based on the service directory;

[0043] It should be noted that the purpose of searching based on the service directory is to quickly locate the target API service; in one example, the service directory contains 10 API services, of which 9 API services are labeled A and 1 API service is labeled B. By searching for B, the API service with label B can be quickly located.

[0044] Step 304: Responding to the search request, obtaining search content from the API list, wherein the search content includes information associated with the target standardized API;

[0045] It should be noted that the search content includes the technical protocol of the API service and the attribute information of the API service. The attribute information includes the name of the API, the function of the API service, and the field to which the API service belongs.

[0046] Step 306: Output the searched content to the service directory.

[0047] It can be seen that the service catalog generation method for microservices provided in the embodiment of the present application can quickly locate the target API service based on the search of the service catalog.

[0048] The method for generating a service catalog of a microservice provided in the embodiment of the present application is as follows: Figure 4 As shown, after step 204 involves outputting the address information of the standardized application program interface to a unified global wide area network page and generating a service directory, the following steps are included:

[0049] Step 402: Obtain a debugging request sent based on the service directory, wherein the debugging request includes debugging content;

[0050] It should be noted that the purpose of debugging is to verify the ability of the service directory to return information; the debugging content in the debugging request is determined based on user needs and can be a set of data or text information.

[0051] Step 404: Determine the corresponding microservice instance according to the address information of the application program interface associated with the debugging request;

[0052] Step 406: Send the debugging request to the microservice instance;

[0053] Step 408: Receive the response information of the microservice instance in response to the debugging request, and input the response information into the global wide area network page where the service directory is located to determine whether the content carried in the response information matches the debugging content.

[0054] Among them, it should be noted that in one example, debugging is performed on the weather microservice instance, the debugging content in the debugging request is the city name, and the response information is the weather information of the day corresponding to the city name. In this example, the debugging content in the debugging request sent based on the service directory is "Kunming", and the response information is "Kunming's weather is sunny today, with a maximum temperature of 30°C and a minimum temperature of 25°C", then it is determined that the content carried in the response information matches the debugging content. If the response information is "Changsha's weather is cloudy today, with a maximum temperature of 40°C and a minimum temperature of 36°C", then it is determined that the content carried in the response information does not match the debugging content.

[0055] It can be seen that the service catalog generation method for microservices provided in the embodiment of the present application can verify the ability of the service catalog to return information through debugging.

[0056] The method for generating a service catalog of a microservice provided in the embodiment of the present application is as follows: Figure 5 As shown, after step 204 involves outputting the address information of the standardized application program interface to a unified global wide area network page and generating a service directory, the following steps are included:

[0057] Step 502: Enter the application associated with the standardized application program interface into the global wide area network page in the service directory;

[0058] It should be noted that application refers to software that needs to be provided to users with the help of a platform.

[0059] Step 504: Bind the application to the standardized application program interface to obtain binding information;

[0060] Step 506: Save the binding information to the binding list and assign an identity key to the application; wherein the standardized application program interface in the binding list is authorized to be called by the application.

[0061] It's important to note that the service catalog enables applications running in Kubernetes clusters to easily use externally hosted software products, providing a list, provisioning, and binding of externally hosted services from service brokers without having to worry about the details of how to create or manage these services. Therefore, the service catalog is an intangible asset. Applications can only call the corresponding standardized application programming interfaces (APIs) after obtaining the identity key. In one example, the service catalog contains 100 API services. In the binding list, application X is authorized to call the first and second API services in the service catalog. When the application calls the first API service in the service catalog, the call succeeds. However, when the application calls the third API service in the service catalog, the call fails due to lack of authorization.

[0062] It can be seen that the service catalog generation method for microservices provided in the embodiment of the present application can manage the API services that can be called by the application, thereby achieving protection of the service catalog.

[0063] The method for generating a service catalog of a microservice provided in the embodiment of the present application is as follows: Figure 6 As shown, after step 506 involves saving the binding information to the binding list and assigning the identity key to the application, the following steps are included:

[0064] Step 602: If the application has an identity identification key, route and forward the application;

[0065] It should be noted that an application has an identity key, which means that the application is authorized to use the corresponding API service; routing forwarding refers to forwarding the identity document (ID) of the target API service that the application wants to access to the cluster where the target API service is located.

[0066] Step 604: If the application does not have the identity identification key, an unauthorized response message is fed back to the application.

[0067] It can be seen that the service directory generation method for microservices provided in the embodiment of the present application can confirm whether the application has an identity identification key, thereby achieving protection of the service directory.

[0068] The method for generating a service catalog of a microservice provided in the embodiment of the present application, in one example, Figure 7 As shown, including:

[0069] Step 702: Scan the service registry in the cluster to obtain the address information of the microservice instance in the service registry;

[0070] Step 704: Obtain information about the application program interface of the microservice instance;

[0071] Step 706: Standardize the application program interface information to obtain standardized application program interface information and generate a service catalog;

[0072] Step 708: Retrieve the service catalog;

[0073] Step 710: Bind the application to the standardized application program interface and assign an identification key to the application;

[0074] Step 712: Call the service directory to confirm whether the application has the identity key;

[0075] Step 714: If the application has the identity key, route it to the target API service in the cluster;

[0076] Step 716: If the application does not have the identity identification key, an unauthorized response message is fed back to the application.

[0077] It can be seen that the service catalog generation method for microservices provided in the embodiment of the present application can form a service catalog for the already developed microservices through the service registration center and provide existing microservices, thereby solving the technical problems in the prior art of complex usage methods of microservice application reuse methods and difficulty in reuse between different development languages ​​and development frameworks.

[0078] The embodiment of the present application provides a device for generating a service catalog of a microservice, such as Figure 8 As shown, the device includes:

[0079] The first processing module 82 is used to obtain the address information of the microservice instance of the service registry by scanning the service registry in the cluster;

[0080] A second processing module 84 is configured to send an access request to the microservice instance based on the address information of the microservice instance to obtain information about the application program interface of the microservice instance;

[0081] The third processing module 86 is used to perform standardization processing on the application program interface information to obtain standardized application program interface information;

[0082] The generating module 88 is used to generate a service catalog based on the information of the standardized application program interface.

[0083] Through the service catalog generation device for microservices provided in the embodiment of the present application, the first processing module is used to scan the service registration center in the cluster to obtain the address information of the microservice instance of the service registration center; the second processing module is used to send an access request to the microservice instance based on the address information of the microservice instance to obtain the application interface information of the microservice instance; the third processing module is used to standardize the application interface information to obtain the standardized application interface information; the generation module is used to generate a service catalog based on the standardized application interface information; that is, a service catalog is formed for the developed microservices through the service registration center, and the existing microservices are provided, thereby solving the technical problems in the prior art of complex microservice application reuse methods and difficulty in reuse between different development languages ​​and development frameworks.

[0084] In an optional implementation manner of the embodiment of the present application, the generation module 88 provided in the embodiment of the present application is as follows: Figure 9 As shown, it may further include:

[0085] A storage unit 92 is configured to store the information of the standardized application program interface in the application program interface list; wherein the information of the standardized application program interface includes the address information of the standardized application program interface, the interface description information of the standardized application program interface, the request parameters of the standardized application program interface, and the response information of the standardized application program interface;

[0086] The generating unit 94 is configured to output the address information of the standardized application program interface to a unified global wide area network page to generate a service directory.

[0087] In an optional implementation manner of the embodiment of the present application, the device provided by the embodiment of the present application, such as Figure 10 As shown, it may further include:

[0088] A first acquisition module 1002 is configured to acquire a search request sent based on a service directory;

[0089] The fourth processing module 1004 is configured to obtain search content from the API list in response to the search request; wherein the search content includes information associated with the target standardized API;

[0090] The output module 1006 is used to output the searched content to the service directory.

[0091] In an optional implementation manner of the embodiment of the present application, the device provided by the embodiment of the present application, such as Figure 11 As shown, it may further include:

[0092] The second acquisition module 1102 is configured to acquire a debugging request sent based on the service directory; wherein the debugging request includes debugging content;

[0093] Determining module 1104, configured to determine a corresponding microservice instance according to address information of an application program interface associated with a debugging request;

[0094] The sending module 1106 is used to send the debugging request to the microservice instance;

[0095] The fifth processing module 1108 is configured to receive response information from the microservice instance in response to the debugging request, and input the response information into the global wide area network page where the service directory is located to determine whether the content carried in the response information matches the debugging content.

[0096] In an optional implementation manner of the embodiment of the present application, the device provided by the embodiment of the present application, such as Figure 12 As shown, it may further include:

[0097] An entry module 1202 is configured to enter an application associated with the standardized application program interface into a global wide area network page in the service catalog;

[0098] The sixth processing module 1204 is configured to bind the application to the standardized application program interface to obtain binding information;

[0099] The seventh processing module 1206 is configured to save the binding information to a binding list and assign an identity key to the application; wherein the standardized application programming interface in the binding list is authorized to be called by the application.

[0100] In an optional implementation manner of the embodiment of the present application, the device provided by the embodiment of the present application, such as Figure 13 As shown, it may further include:

[0101] Forwarding module 1302, configured to route and forward the application if the application has an identity identification key;

[0102] The feedback module 1304 is configured to feedback unauthorized response information to the application when the application does not have the identity identification key.

[0103] The present application also provides an electronic device, such as Figure 14 As shown, it includes a processor 1401, a communication interface 1402, a memory 1403 and a communication bus 1404, wherein the processor 1401, the communication interface 1402, and the memory 1403 communicate with each other through the communication bus 1404.

[0104] Memory 1403, used for storing computer programs;

[0105] Processor 1401 is used to execute the program stored in memory 1403 to achieve Figure 1The method steps in Figure 1 The method and steps are the same as in , and will not be repeated here.

[0106] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 14 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0107] The communication interface is used for communication between the above terminal and other devices.

[0108] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0109] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0110] In another embodiment provided by the present application, a computer-readable storage medium is further provided, which stores instructions. When the computer-readable storage medium is executed on a computer, the computer executes the service catalog generation method for microservices described in any of the above embodiments.

[0111] In another embodiment provided by the present application, a computer program product including instructions is further provided, which, when executed on a computer, enables the computer to execute the service catalog generation method for microservices described in any of the above embodiments.

[0112] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0113] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0114] Each embodiment in this specification is described in a related manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiment is generally similar to the method embodiment, so the description is relatively simple. For related parts, refer to the description of the method embodiment.

[0115] The above description is only a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the scope of protection of the present application.

Claims

1. A method for generating a service catalog of a microservice, characterized in that: include: By scanning the service registry in the cluster, obtain the address information of the microservice instance of the service registry; Based on the address information of the microservice instance, an access request is sent to the microservice instance to obtain the application program interface information of the microservice instance; wherein the microservice instance obtains the application program interface information through the swagger component; Standardizing the information of the application program interface to obtain standardized application program interface information; The service catalog is generated based on information of the standardized application program interface.

2. The method according to claim 1, characterized in that Generating the service catalog based on the information of the standardized application program interface includes: Saving the information of the standardized application program interface to an application program interface list; wherein the information of the standardized application program interface includes the address information of the standardized application program interface, the interface description information of the standardized application program interface, the request parameters of the standardized application program interface, and the response information of the standardized application program interface; The address information of the standardized application program interface is output to a unified global wide area network page to generate the service directory.

3. The method according to claim 2, characterized in that After outputting the standardized application program interface address information to a unified global wide area network page to generate the service directory, the method further includes: Obtaining a search request sent based on the service directory; In response to the search request, obtaining search content from the API list, wherein the search content includes information associated with a target standardized API; The searched content is output to the service directory.

4. The method according to claim 2, characterized in that After outputting the standardized application program interface address information to a unified global wide area network page to generate the service directory, the method further includes: Acquire a debugging request sent based on the service directory, wherein the debugging request includes debugging content; Determine a corresponding microservice instance according to address information of an application program interface associated with the debugging request; Sending the debugging request to the microservice instance; Receive response information from the microservice instance in response to the debugging request, and input the response information into the global wide area network page where the service directory is located to determine whether content carried in the response information matches the debugging content.

5. The method according to claim 2, characterized in that After outputting the standardized application program interface address information to a unified global wide area network page to generate the service directory, the method further includes: Entering an application associated with the standardized application program interface into the global wide area network page in the service catalog; Binding the application to the standardized application program interface to obtain binding information; The binding information is saved in a binding list, and an identity identification key is assigned to the application; wherein the standardized application program interface in the binding list is authorized to be called by the application.

6. The method according to claim 5, characterized in that After the binding information is saved in the binding list and the identity key is assigned to the application, the method includes: When the application has the identity identification key, routing and forwarding the application; In the case that the application does not have the identity identification key, unauthorized response information is fed back to the application.

7. A device for generating a service catalog of microservices, characterized in that: include: The first processing module is used to obtain the address information of the microservice instance of the service registry by scanning the service registry in the cluster; A second processing module is configured to send an access request to the microservice instance based on the address information of the microservice instance to obtain information about the application program interface of the microservice instance; wherein the microservice instance obtains the information about the application program interface through a swagger component; A third processing module is used to perform standardization processing on the application program interface information to obtain standardized application program interface information; A generating module is used to generate the service catalog based on the information of the standardized application program interface.

8. The device according to claim 7, characterized in that The generation module includes: A storage unit, configured to store information of the standardized application program interface in an application program interface list; wherein the information of the standardized application program interface includes address information of the standardized application program interface, interface description information of the standardized application program interface, request parameters of the standardized application program interface, and response information of the standardized application program interface; The generating unit is configured to output the address information of the standardized application program interface to a unified global wide area network page to generate the service directory.

9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory for storing computer programs; A processor, configured to implement the method steps described in any one of claims 1 to 6 when executing a program stored in a memory.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Service providing method and device and electronic equipment

    CN112291178A