Service request forwarding method and device, equipment and storage medium

By obtaining and saving network configuration information, matching and forwarding service requests, the problem that joint debugging results cannot be presented directly is solved, and the effect of directly viewing debugging results on the development computer and improving debugging efficiency is achieved.

CN119583654AActive Publication Date: 2025-03-07GUANGZHOU SHIYUAN ELECTRONICS CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311157046.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-07
Publication Date
2025-03-07
Estimated Expiration
2043-09-07

AI Technical Summary

Technical Problem

During the development of back-end service software, the results of joint debugging cannot be presented directly on the computer used in the development, and the debugging results are complex to view and the debugging efficiency is low.

Method used

By obtaining network configuration information, including service registration information, it saves it to the service registration list, and receives service request information sent by the client. When matching the target service registration information, the service request information is sent to the target backend server for debugging.

Benefits of technology

It implements forwarding service requests to the specified local backend server, allowing users to view debugging results directly on the computer used by development, improving debugging efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119583654A_ABST
    Figure CN119583654A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a service request forwarding method and device, equipment and a storage medium. The method comprises the steps of obtaining network configuration information; service registration information in the network configuration information is stored in a service registration list; receiving service request information sent by the client; and under the condition that target service registration information is matched from a service registration list according to the client address identifier and the service request identifier, sending the service request information to a target back-end server corresponding to the service address identifier in the target service registration information, so that the target back-end server forwards the service request information. Through the method, the service request for service debugging sent by the specified client can be forwarded to the specified local back-end server for operation and debugging according to the network configuration information, so that a joint debugging result can be specified to be directly presented on a computer used for development, a developer can conveniently check the debugging result, and the debugging efficiency is improved. And the debugging efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of software testing technology, and in particular to a method, apparatus, device and storage medium for forwarding a service request. Background Art

[0002] For applications, the quality of backend services largely determines the user experience of the application. If the application does not have a complete backend service, it will be difficult for users to find the content and functions they want on this application.

[0003] In order to improve backend services and user experience, backend developers and frontend developers often need to jointly debug during the development of backend service software. However, during the joint debugging process, for service requests initiated by the frontend, the gateway will allocate service requests to appropriate backend servers for response based on a pre-set allocation strategy based on the number of tasks, data processing volume, etc. The results of the joint debugging cannot be directly presented on the computer used for development, and the debugging results are complicated to view and the debugging efficiency is low. Summary of the invention

[0004] The embodiments of the present application provide a service request forwarding method, apparatus, device and storage medium to solve the problem that the results of joint debugging cannot be directly presented on the computer used for development, the debugging results are complicated to view, and the debugging efficiency is low.

[0005] In a first aspect, an embodiment of the present application provides a method for forwarding a service request, comprising:

[0006] Obtaining network configuration information, the network configuration information includes at least one service registration information, each service registration information includes a corresponding service address identifier, a registration service identifier and multiple registration address identifiers, the registration service identifier is used to represent the corresponding backend service, and the service address identifier is used to identify the running device of the corresponding backend service;

[0007] Save the service registration information to the service registration list;

[0008] Receive service request information sent by the client, the service request information including the client address identifier and the service request identifier;

[0009] When the target service registration information is matched from the service registration list based on the client address identifier and the service request identifier, the service request information is sent to the target back-end server corresponding to the service address identifier in the target service registration information for forwarding by the target back-end server; the registration address identifier and registration service identifier in the target service registration information are matched with the client address identifier and the service request identifier respectively.

[0010] In a second aspect, an embodiment of the present application provides a device for forwarding a service request, including:

[0011] An information acquisition module, used to acquire network configuration information, the network configuration information includes at least one service registration information, each service registration information includes a corresponding service address identifier, a registration service identifier and multiple registration address identifiers, the registration service identifier is used to represent the corresponding backend service, and the service address identifier is used to identify the running device of the corresponding backend service;

[0012] An information saving module is used to save the service registration information to the service registration list;

[0013] A service receiving module, used to receive service request information sent by a client, the service request information including a client address identifier and a service request identifier;

[0014] The service forwarding module is used to send the service request information to the target backend server corresponding to the service address identifier in the target service registration information when the target service registration information is matched from the service registration list based on the client address identifier and the service request identifier, so that the target backend server can debug; the registration address identifier and registration service identifier in the target service registration information are matched with the client address identifier and the service request identifier respectively.

[0015] In a third aspect, an embodiment of the present application provides an electronic device, including a memory and one or more processors;

[0016] A memory for storing one or more programs;

[0017] When one or more programs are executed by one or more processors, the one or more processors implement the service request forwarding method of the first aspect.

[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the method for forwarding a service request as in the first aspect is implemented.

[0019] The embodiment of the present application obtains network configuration information, the network configuration information includes at least one service registration information, each service registration information includes a corresponding service address identifier, a registration service identifier and multiple registration address identifiers, the registration service identifier is used to represent the corresponding backend service, and the service address identifier is used to identify the running device of the corresponding backend service; the service registration information is saved in the service registration list; the service request information sent by the client is received, and the service request information includes the client address identifier and the service request identifier; when the target service registration information is matched from the service registration list according to the client address identifier and the service request identifier, the service request information is sent to the target backend server corresponding to the service address identifier in the target service registration information, so that the target backend server can forward it; the registration address identifier and the registration service identifier in the target service registration information are matched with the client address identifier and the service request identifier respectively. By saving the network configuration information to specify the forwarding strategy of a specific service request to the gateway, the gateway forwards the service request for service debugging sent by the specified client to the specified local backend server for running and debugging according to the network configuration information, so that the user can debug the backend service, so that the result of the joint debugging can be directly presented on the computer used for development, and the developer can conveniently view the debugging results, thereby improving the debugging efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 It is a method flow chart of a method for forwarding a service request provided in an embodiment of the present application;

[0021] Figure 2 This is a schematic diagram of the process of Spring Cloud Gateway implementing network request sending;

[0022] Figure 3 This is a test environment architecture diagram provided by an embodiment of the present application;

[0023] Figure 4 It is a process diagram of a method for forwarding a service request provided in an embodiment of the present application;

[0024] Figure 5 It is a process diagram of another method for forwarding a service request provided in an embodiment of the present application;

[0025] Figure 6 It is a structural diagram of a device for forwarding a service request provided in an embodiment of the present application;

[0026] Figure 7 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.

[0028] During the software development process, in order to simulate actual use, service requests need to be sent to the gateway, and then the gateway will distribute the service requests to the corresponding server. At the same time, in order to facilitate debugging of the program, the specified service request needs to be forwarded to the local server. However, for service requests, the gateway will distribute the service request to the appropriate backend server according to the pre-stored distribution strategy, resulting in the service request may not be able to run and debug on the server required by the user.

[0029] In response to the problems existing in the prior art mentioned above, the service request forwarding method proposed in the embodiment of the present application saves network configuration information to the gateway to specify the forwarding strategy for specific service requests. The gateway forwards the service request for service debugging sent by the specified client to the specified local back-end server for running and debugging based on the network configuration information, so that users can debug the back-end service, and the results of the joint debugging can be directly presented on the computer used for development. Developers can easily view the debugging results, thereby improving debugging efficiency.

[0030] Figure 1 is a method flow chart of a method for forwarding a service request provided by an embodiment of the present application, such as Figure 1 As shown, the forwarding method of the service request is applied to the gateway, including but not limited to steps S110 to S140:

[0031] Step S110, obtain network configuration information, the network configuration information includes at least one service registration information, each service registration information includes a corresponding service address identifier, a registration service identifier and multiple registration address identifiers, the registration service identifier is used to represent the corresponding backend service, and the service address identifier is used to identify the running device of the corresponding backend service.

[0032] In step S110, the gateway needs to obtain network configuration information. In this embodiment, there is no restriction on the channel for obtaining the network configuration information. The network configuration information can be obtained directly by reading the local database, or obtained from other electronic devices and computer systems through a data transmission interface or remote communication transmission. After obtaining the network configuration information, it is necessary to extract data from the network configuration information to obtain the service registration information of the network configuration information, so that the gateway can subsequently forward the debugging service request sent by the client to the target client for debugging.

[0033] The gateway of this embodiment can be Nginx, Kong, Envoy and Spring Cloud Gateway. Here, Spring Cloud Gateway is taken as an example to describe the working principle of the gateway. Figure 2 The following figure shows the basic process of Spring CloudGateway to implement network request sending. Spring Cloud Gateway is a microservice gateway based on SpringFramework. It implements the routing and processing of service requests through a combination of routing configuration and filter chain. When receiving a service request from a gateway client (Gateway Client), Spring Cloud Gateway finds a route that matches the service request in the Gateway Handler Mapping and sends it to the Gateway WebHandler. The Gateway Web Handler then sends the service request to the actual service execution business logic through the specified filter chain, and then returns the execution result. Figure 2 The filters are separated by dotted lines because the filters may execute business logic before ("pre") or after ("post") sending the proxy request. In this way, SpringCloud Gateway can provide routing, filtering, load balancing and other functions to help simplify inter-service communication and functional expansion in the microservice architecture.

[0034] In this embodiment, the gateway can implement specific service request processing through network configuration information. When receiving a service request from a client with a specified IP address, the service request can be forwarded to a server with a specified IP address, and the server with the specified IP address can run and debug it. In the embodiment of the present application, in order to implement the above specified forwarding and execution process, the network configuration information is redefined. The network configuration information includes at least one service registration information, and each service registration information includes a corresponding service address identifier, a registered service identifier, and multiple registered address identifiers. The service address identifier is used to identify the running device of the corresponding backend service. It can be an IP address, a host name, or other identifier that can uniquely identify the device, which indicates the location of the backend service in the network. The registered service identifier is used to uniquely identify the corresponding backend service, and the identifier can be a string or a symbol that can uniquely identify the service in the entire system. The registered address identifier is used to specify multiple client addresses that initiate service requests. These addresses can be physical addresses, virtual addresses, or addresses of a service registration center, and the service requests initiated by the specified client can be identified. It can be understood that the same service may be initiated by multiple clients, so multiple registered addresses can be configured according to actual needs.

[0035] like Figure 3 The figure shows a test environment architecture diagram provided by an embodiment of the present application, which includes multiple clients (exemplary client A, client B and client C) and multiple servers (exemplary server A, server B and server C), and each client and server is connected to a gateway. The network configuration information can be set by the client or server in the test environment, or it can be set by other terminal devices. For a service registration information in the network configuration information, the service request information of the client with the specified IP address to be registered is required, that is, the registration service identifier and the registration address identifier; through the registration service identifier and the registration address identifier, the service request that needs to be forwarded can be determined. In addition, it is necessary to configure a target server for the service request according to actual needs, and write the IP address of the target server into the service registration information. Exemplarily, during the test process, client A is used to develop front-end software, and server C is used to develop corresponding back-end software. During the test process, in order to simulate the actual use process, it is necessary to debug the front-end software on client A, and send the corresponding service request to server C for response, so that the back-end software developer of server C can conveniently view the debugging process. In the prior art, the service request can be based on Figure 2The network management of the framework shown in the figure forwards it, but this forwarding cannot guarantee the directional sending of the service request at both ends. Corresponding to the above operation requirements, based on the embodiment of the present application, it can be achieved through network configuration information, that is, the user needs to forward the service request B on the client A to the server C for operation and debugging, then it is necessary to write the IP address of the client A, the identifier of the service request B and the IP address of the server C in the service registration information. Through these network configuration information, the system can establish a mapping relationship between the service and its operating device, and provide the client or gateway with the ability to confirm and access the back-end service.

[0036] It should be noted that the server in the embodiment of the present application is not a dedicated server in a narrow sense, but can run back-end software and can exist in any device form, and is another device compared to the device running front-end software.

[0037] Step S120: Save the service registration information to the service registration list.

[0038] In step S120, the service registration information needs to be saved in the service registration list to facilitate the management and maintenance of the registration information of the back-end service. Different data structures can be used to implement the service registration list, such as lists, sets, hash tables, etc. The specific selection depends on the needs and the technology stack used. Specifically, it is necessary to first create a data structure containing relevant fields in the network configuration information, such as the registration service identifier, the service address identifier, and the registration address identifier. Then, a data structure of a service registration list is created in the system to save the service registration information. Here, a suitable data structure, such as a list, a set, or a hash table, can be selected according to actual needs. Subsequently, the service information is registered. When a new service needs to be registered, a service registration information object is created and added to the service registration list, and it is ensured that the service registration identifier is unique in the list. According to needs, specific service registration information can be queried and obtained through the registration service identifier and the registration address identifier in the service registration information. If the network configuration of the service changes, the corresponding service registration information can be updated.

[0039] Step S130: receiving service request information sent by the client, where the service request information includes a client address identifier and a service request identifier.

[0040] In step S130, it is necessary to receive the service request information sent by the client to obtain the client address identifier and the service request identifier therein. The client address identifier refers to the address identifier of the client that initiates the service request. It can be the IP address, host name or other identifier that can uniquely identify the client. The client address identifier helps to identify the source of the request for subsequent processing and response. The service request identifier is used to identify the specific service requested. The service request identifier is usually a string or symbol that is used to uniquely identify a service or function in the system. It can be a service name, API endpoint or other identifier that can uniquely identify the service request. In this embodiment, the processing method of the service request can be determined by matching the client address identifier and the service request identifier with the information in the service registration list. It can be understood that for a service request issued by a specified IP address, it needs to be forwarded to the server of the specified IP address, and for a non-specified general service request, the gateway will forward the general service request to a suitable server for execution according to the previously configured request allocation strategy (such as: sending the service request to a server with more available resources for execution).

[0041] Step S140: When the target service registration information is matched from the service registration list according to the client address identifier and the service request identifier, the service request information is sent to the target back-end server corresponding to the service address identifier in the target service registration information for forwarding by the target back-end server; the registration address identifier and the registration service identifier in the target service registration information are matched with the client address identifier and the service request identifier respectively.

[0042] In step S140, the service request information sent by the client needs to be matched with the information stored in the service registration list to determine whether the service request information needs to be forwarded to the designated server. When the service request information sent by the client can match the corresponding result in the service registration list, it means that the service request information is pre-registered service information that needs to be used for debugging, so the service request information needs to be forwarded to the corresponding designated server. Specifically, the service request information is obtained in step 130, and the client address identifier and service request identifier therein are extracted. Next, the client address identifier and the service request identifier need to be matched with the registration address identifier and the registration request identifier recorded in the service registration list, respectively. When the registration address identifier and the registration request identifier in the same service registration information in the server registration list are the same, it indicates that the service request information belongs to a service request for a specific test, and the service registration information is confirmed as the target service registration information. The service address identifier recorded in the target service registration information can be defined as the target service address identifier. Subsequently, the service request information sent by the client is forwarded to the back-end server corresponding to the target service address identifier so that the user can debug it.

[0043] In the forwarding method of the above service request, by obtaining network configuration information, the network configuration information includes at least one service registration information, each service registration information includes a corresponding service address identifier, a registration service identifier and multiple registration address identifiers, the registration service identifier is used to represent the corresponding backend service, and the service address identifier is used to identify the running device of the corresponding backend service; the service registration information is saved in the service registration list; the service request information sent by the client is received, and the service request information includes the client address identifier and the service request identifier; when the target service registration information is matched from the service registration list according to the client address identifier and the service request identifier, the service request information is sent to the target backend server corresponding to the service address identifier in the target service registration information, so that the target backend server can forward it; the registration address identifier and the registration service identifier in the target service registration information are matched with the client address identifier and the service request identifier respectively. By saving the network configuration information to specify the forwarding strategy of a specific service request to the gateway, the gateway forwards the service request for service debugging sent by the specified client to the specified local backend server for running and debugging according to the network configuration information, so that the user can debug the backend service, so that the result of the joint debugging can be directly presented on the computer used for development, and the developer can conveniently view the debugging result, thereby improving the debugging efficiency.

[0044] refer to Figure 4 , Figure 4 This is a flow chart of a method for forwarding a service request provided by an embodiment of the present application. The following takes the example of obtaining a network configuration file from a cloud registration database to illustrate the workflow of this embodiment:

[0045] When the user needs to debug, first record and upload the client (i.e., client B) related to the test, the related server request and the server C running the backend software to the cloud registration database in a preset format. The gateway periodically actively downloads the network configuration file from the cloud registration database and saves it in the local database of the gateway. The network configuration file contains network configuration information including at least one service registration information. Each service registration information includes a corresponding service address identifier, a registered service identifier and multiple registered address identifiers. Of course, the gateway can also monitor the changes in the network configuration file of the cloud registration database and update it when changes occur. During the test, the client B at the specified IP initiates a service request corresponding to the backend service that needs to be debugged. The service request contains a client address identifier and a service request identifier. After receiving it, the gateway will compare the identification information. When the corresponding target service address is matched, the service request sent by the client B at the specified IP is forwarded to the target backend server corresponding to the target service address. For general service requests generated by clients A and C that have not been registered in the cloud registration database, the gateway will select a suitable server from all servers for forwarding according to the preset allocation strategy.

[0046] Understandably, reference Figure 5 , Figure 5 This is a flow chart of another method for forwarding service requests provided by an embodiment of the present application. When the client address of the specified IP is the same as the server address of the specified IP (i.e., the client and the server are on the same device), when the device sends a service request, the gateway will return the service request to the local server for execution, so that the user can perform local debugging operations.

[0047] As an optional implementation method, the configuration information is stored in a cloud registration database; accordingly, obtaining the network configuration information includes: obtaining the network configuration information in the cloud registration database according to a preset time interval.

[0048] In this embodiment, the network configuration information is stored in a cloud registration database, which is set on a server. When the network configuration information needs to be obtained, the server where the cloud registration database is located is accessed to extract the corresponding data. The cloud registration database may be zookeeper. Specifically, the network configuration information including the service registration information is stored on zookeeper. The Spring Cloud Gateway gateway service can obtain the network configuration information on zookeeper and save it to the local memory for access at any time. For the network configuration information, it can be based on a preset time interval to regularly obtain the network configuration information of the cloud registration database to update the local network configuration information. It can also be that when an update event occurs in the cloud registration database, a corresponding update instruction is generated and sent to the gateway, and the gateway accesses the data in the cloud registration database according to the update instruction to update the local data. Through this embodiment, the network configuration information on the gateway can be updated in real time, which is convenient for users to debug new backend services.

[0049] In another optional embodiment, the target service registration information is matched in the following manner:

[0050] Match the client address identifier and the service request identifier with the registration address identifier and the registration request identifier recorded in the service registration list respectively;

[0051] When the registration address identifier and the registration request identifier in the same service registration information in the server registration list are both corresponding to each other, the service registration information is confirmed as the target service registration information.

[0052] In this embodiment, it is necessary to match the service request information sent by the client with the information stored in the service registration list to determine whether the service request information needs to be forwarded to the designated server. When the client address identifier is the same as the registration address identifier, and the service request type identifier is the same as the registration request type identifier, the service address identifier recorded in the service registration information is confirmed as the target service address identifier. Specifically, the client address identifier and the service request identifier are obtained, the service registration list is traversed, and the registration service information is matched one by one. For each service registration information, the client address identifier is matched with the registration address identifier. If the match is successful, the service request identifier is continued to be matched with the registration request identifier. If the service request identifier is also matched successfully, the service address identifier recorded in the service registration information is confirmed as the target service address identifier. It can be understood that the order of identifier matching has no effect on the effect of this embodiment. The client address identifier can be matched with the registration address identifier first, or the service request identifier can be matched with the registration request identifier first, or both can be performed at the same time, which is not specifically limited in this embodiment.

[0053] Through the above matching process, the correct target service address identifier can be determined so that the service request information can be sent to the corresponding target backend server for further processing and forwarding. In this way, it can be ensured that the request can be correctly routed to the target service and the user's personalized debugging needs can be met.

[0054] As an optional embodiment, the service request forwarding method further includes:

[0055] Match the client address identifier and the service request identifier with the registration address identifier and the registration request identifier recorded in the service registration list respectively;

[0056] When at least one of the registration address identifier and the registration request identifier in the same service registration information in the server registration list is different, a request failure message is generated;

[0057] Return the request failure information to the client.

[0058] In this embodiment, the service request information sent by the client needs to be matched with the information stored in the service registration list to determine whether the service request information needs to be forwarded to the designated server. When the client address identifier is the same as the registration address identifier, and the service request type identifier is different from the registration request type identifier, it means that the service request information has not been registered in the service registration list and is a general service request. When the above-mentioned zookeeper is running, it is assumed that the user needs to perform debugging operations. Therefore, on the one hand, the general service request will be allocated to the appropriate server for operation according to the allocation strategy preset by the gateway. On the other hand, the gateway will generate a request failure message to remind the user that the service request has not been registered and cannot be sent to the server of the specified IP for operation and debugging.

[0059] It is understandable that the request failure information can be returned not only to the client, but also to the message processing server, which is used to receive various request response information. The user can view all request responses uniformly on the message processing server.

[0060] As an optional embodiment, after sending the service request information to the target backend server corresponding to the service address identifier in the target service registration information, the method further includes:

[0061] Receive the forwarding result returned by the target backend server and send the forwarding result to the target client.

[0062] During the development of the back-end service software, in order to meet the need for joint debugging with the front-end developers, this embodiment forwards the service request to the designated server. When the user completes the debugging on the designated server, the gateway obtains the debugging result and forwards it to the front-end client as the forwarding result, so that the front-end developers can further debug the front-end according to the debugging results of the back-end developers.

[0063] In this embodiment, the forwarding result returned by the target back-end server needs to be forwarded to the corresponding target client for front-end debugging. Specifically, the gateway receives the forwarding result returned by the target back-end server, which includes the service request information and the debugging result information of the back-end server. Then, according to the service request information in the forwarding result, the corresponding forwarding client identifier is matched in the service registration list. The forwarding client identifier can be used to determine which target client the forwarding result is sent to. Subsequently, the forwarding result is sent to the target client corresponding to the forwarding client identifier. This can be achieved by an appropriate communication protocol or message delivery mechanism to ensure that the forwarding result reaches the target client. Through these steps, the forwarding result of the target back-end server can be sent to the correct target client. According to the service request information in the forwarding result, the corresponding forwarding client identifier is found, and the result is sent to the target client corresponding to the identifier. In this way, the client can obtain the data of the back-end service or the debugging result of the back-end service, and perform subsequent processing and debugging.

[0064] As a specific service request generation method, the service request information is generated by the front-end debugger on the client. The front-end debugger is the front-end software to be debugged during the development process. The front-end debugger can include but is not limited to WebStorm, VSCode and Postman as testing tools. When a user needs to debug a back-end service, the debugger on the client of the specified IP can be controlled to generate the corresponding service request for debugging.

[0065] Figure 6 Schematic diagram of the structure of the device for forwarding service requests provided in the embodiment of the present application. Figure 5 The service request forwarding device includes: an information acquisition module 210, an information storage module 220, a service receiving module 230 and a service forwarding module 240.

[0066] Among them, the information acquisition module 210 is used to obtain network configuration information, the network configuration information includes at least one service registration information, each service registration information includes a corresponding service address identifier, a registration service identifier and multiple registration address identifiers, the registration service identifier is used to represent the corresponding back-end service, and the service address identifier is used to identify the operating device of the corresponding back-end service; the information saving module 220 is used to save the service registration information to the service registration list; the service receiving module 230 is used to receive the service request information sent by the client, the service request information includes the client address identifier and the service request identifier; the service forwarding module 240 is used to send the service request information to the target back-end server corresponding to the service address identifier in the target service registration information when the target service registration information is matched from the service registration list according to the client address identifier and the service request identifier, so as to facilitate the target back-end server to debug; the registration address identifier and the registration service identifier in the target service registration information are matched with the client address identifier and the service request identifier respectively.

[0067] Based on the above embodiment, the configuration information is stored in the cloud registration database;

[0068] Information acquisition module, including:

[0069] The information acquisition unit is used to acquire network configuration information from a cloud registration database according to a preset time interval.

[0070] Based on the above embodiment, the service forwarding module includes:

[0071] An identifier matching unit, used to match the client address identifier and the service request identifier with the registration address identifier and the registration request identifier recorded in the service registration list respectively;

[0072] The identification confirmation unit is used to confirm the service address identification recorded in the service registration information as the target service address identification when the registration address identification and the registration request identification in the same service registration information in the server registration list are corresponding to each other.

[0073] Based on the above embodiment, the device for forwarding a service request further includes:

[0074] An identification matching module is used to match the client address identification and the service request identification with the registration address identification and the registration request identification recorded in the service registration list respectively;

[0075] A failure information module, used for generating request failure information when at least one of the registration address identifier and the registration request identifier in the same service registration information in the server registration list is different;

[0076] The information return module is used to return the request failure information to the client.

[0077] Based on the above embodiment, the device for forwarding a service request further includes:

[0078] The result forwarding module is used to receive the forwarding result returned by the target backend server and send the forwarding result to the target client.

[0079] Based on the above embodiment, the service request information is generated by the front-end debugging program on the client.

[0080] The device for forwarding a service request provided in an embodiment of the present invention is included in an electronic device and can be used to execute any of the methods for forwarding a service request provided in the above embodiments, and has corresponding functions and beneficial effects.

[0081] It is worth noting that in the embodiment of the forwarding device for the above-mentioned service request, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0082] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 7 As shown, the electronic device includes a processor 310 and a memory 320. In a common product form, it may also include an input device 330, an output device 340, and a communication device 350. The number of processors 310 in the electronic device may be one or more. Figure 7 A processor 310 is taken as an example; the processor 310, the memory 320, the input device 330, the output device 340 and the communication device 350 in the electronic device can be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.

[0083] The memory 320, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the method for forwarding service requests in the embodiment of the present application (for example, the information acquisition module 210, the information storage module 220, the service receiving module 230 and the service forwarding module 240 in the device for forwarding service requests). The processor 310 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 320, that is, implements the method for forwarding service requests described above.

[0084] The memory 320 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 320 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 320 may further include a memory remotely arranged relative to the processor 310, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0085] The input device 330 may be used to receive network configuration information. The output device 340 may include a display device such as a display screen.

[0086] The electronic device mentioned above includes a service request forwarding device, which can be used to execute any service request forwarding method and has corresponding functions and beneficial effects.

[0087] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by an electronic device, it implements the relevant operations in the service request forwarding method provided in any embodiment of the present application and has corresponding functions and beneficial effects.

[0088] Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products.

[0089] Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the functions in the process. Figure 1 A process or multiple processes and / or boxes Figure 1These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0090] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0091] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0092] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0093] Note that the above are only preferred embodiments of the present application and the technical principles used. Those skilled in the art will understand that the present application is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.

Claims

1. A method for forwarding a service request, applied to a gateway, characterized in that: include: Acquire network configuration information, the network configuration information including at least one service registration information, each service registration information including a corresponding service address identifier, a registration service identifier and a plurality of registration address identifiers, the registration service identifier is used to characterize the corresponding backend service, and the service address identifier is used to identify the running device of the corresponding backend service; Saving the service registration information to a service registration list; Receive service request information sent by a client, wherein the service request information includes a client address identifier and a service request identifier; When the target service registration information is matched from the service registration list according to the client address identifier and the service request identifier, the service request information is sent to the target back-end server corresponding to the service address identifier in the target service registration information for debugging by the target back-end server; the registration address identifier and registration service identifier in the target service registration information are matched with the client address identifier and the service request identifier respectively.

2. The method for forwarding a service request according to claim 1, characterized in that: The configuration information is stored in a cloud registration database; The obtaining of network configuration information includes: The network configuration information is obtained in the cloud registration database according to a preset time interval.

3. The method for forwarding a service request according to claim 1, characterized in that: The target service registration information is matched in the following way: Matching the client address identifier and the service request identifier with the registration address identifier and the registration request identifier recorded in the service registration list respectively; When the registration address identifier and the registration request identifier in the same service registration information in the server registration list are both corresponding and identical, the service registration information is confirmed as the target service registration information.

4. The method for forwarding a service request according to claim 3, characterized in that: Also includes: Matching the client address identifier and the service request identifier with the registration address identifier and the registration request identifier recorded in the service registration list respectively; When at least one of the registration address identifier and the registration request identifier in the same service registration information in the server registration list is different, a request failure message is generated; The request failure information is returned to the client.

5. The method for forwarding a service request according to claim 1, characterized in that: After sending the service request information to the target backend server corresponding to the service address identifier in the target service registration information, the method further includes: Receive the forwarding result returned by the target backend server, and send the forwarding result to the client corresponding to the client address identifier.

6. The method for forwarding a service request according to claim 1, characterized in that: The service request information is generated by a front-end debugging program on the client.

7. A service request forwarding device, applied to a gateway, characterized in that: include: An information acquisition module, used to acquire network configuration information, wherein the network configuration information includes at least one service registration information, each service registration information includes a corresponding service address identifier, a registration service identifier and multiple registration address identifiers, the registration service identifier is used to represent the corresponding backend service, and the service address identifier is used to identify the running device of the corresponding backend service; An information saving module, used to save the service registration information to a service registration list; A service receiving module, used to receive service request information sent by a client, wherein the service request information includes a client address identifier and a service request identifier; A service forwarding module is used to send the service request information to a target backend server corresponding to the service address identifier in the target service registration information when the target service registration information is matched from the service registration list according to the client address identifier and the service request identifier, so that the target backend server can debug; the registration address identifier and registration service identifier in the target service registration information are matched with the client address identifier and the service request identifier respectively.

8. The service request forwarding device according to claim 7, characterized in that: The configuration information is stored in a cloud registration database; The information acquisition module comprises: The information acquisition unit is used to acquire the network configuration information from the cloud registration database according to a preset time interval.

9. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the first display device implements the service request forwarding method as described in any one of claims 1 to 6.

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

Citation Information

Patent Citations

  • Method and device used for debugging microservice

    CN109150978A

  • Routing method for service debugging, electronic equipment, medium and program product

    CN114205342A

  • Micro-service request processing method and device, equipment and medium

    CN114866617A