Service request forwarding method, device, and apparatus, and storage medium

By acquiring and saving network configuration information, the client's service request information is matched to the target backend server, solving the problem that joint debugging results cannot be directly presented, and realizing convenient viewing of debugging results and improved efficiency.

CN119583654BActive Publication Date: 2026-01-20GUANGZHOU SHIYUAN ELECTRONICS CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

During the development of backend service software, the results of joint debugging cannot be directly displayed on the computer used for development. Viewing the debugging results is complicated and the debugging efficiency is low.

Method used

By acquiring network configuration information and saving it as a service registration list, the system receives service request information from clients and matches it to the target backend server based on the client address and service request identifier. This enables the forwarding of specified service requests to a specified local backend server for operation and debugging.

Benefits of technology

It allows users to directly view the joint debugging results on the computer they are using for development, thus improving debugging efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119583654B_ABST
    Figure CN119583654B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a service request forwarding method and device, equipment and a storage medium. Embodiments of the present application acquire network configuration information, save service registration information in the network configuration information to a service registration list, receive service request information sent by a client, and in the case that target service registration information is matched from the service registration list according to a client address identifier and a service request identifier, send the service request information to a target backend server corresponding to a service address identifier in the target service registration information for forwarding by the target backend server. This method can forward service requests for service debugging sent by specified clients to specified local backend servers for running and debugging according to network configuration information, so that the results of joint debugging can be directly presented on the computer used for development, and developers can conveniently check the debugging results, thereby improving the debugging efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of software testing, and particularly relate to a service request forwarding method and device, equipment and a storage medium. BACKGROUND

[0002] For an application, the quality of the backend service determines the user experience of the application to a large extent. If the application does not have a perfect backend service, it is difficult for the user to find the content and function he wants on the application.

[0003] In order to perfect the backend service and improve the user experience, the backend developer often needs to jointly debug with the frontend developer in the process of developing the backend service software. However, in the process of joint debugging, for the service request initiated by the frontend, the gateway will distribute the service request to the appropriate backend server for response according to the pre-set distribution strategy based on the number of tasks, data processing capacity and the like as a reference. The result of joint debugging cannot be directly presented on the computer used for development, the viewing of the debugging result is complex, and the debugging efficiency is low. SUMMARY

[0004] Embodiments of the present application provide a service request forwarding method, device, equipment and storage medium to solve the problem that the result of joint debugging cannot be directly presented on the computer used for development, the viewing of the debugging result is complex, and the debugging efficiency is low.

[0005] In a first aspect, the embodiments of the present application provide a service request forwarding method, comprising:

[0006] Obtaining network configuration information, the network configuration information comprising at least one service registration information, each service registration information comprising a corresponding service address identifier, a registration service identifier and a plurality of registration address identifiers, the registration service identifier being used to represent the corresponding backend service, and the service address identifier being used to identify the running equipment of the corresponding backend service;

[0007] Saving the service registration information to a service registration list;

[0008] Receiving service request information sent by a client, the service request information comprising a client address identifier and a service request identifier;

[0009] In a case where a target service registration information is matched from the service registration list according to the client address identifier and the service request identifier, sending the service request information to a target backend server corresponding to the service address identifier in the target service registration information for forwarding by the target backend 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.

[0010] In a second aspect, an embodiment of the present application provides a service request forwarding apparatus, comprising:

[0011] an information obtaining module, configured to obtain network configuration information, the network configuration information comprising at least one piece of service registration information, each piece of service registration information comprising a corresponding service address identifier, a registration service identifier and a plurality of registration address identifiers, the registration service identifier being used to represent the corresponding backend service, and the service address identifier being used to identify a running device of the corresponding backend service;

[0012] an information saving module, configured to save the service registration information to a service registration list;

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

[0014] a service forwarding module, configured to, in a case where a target service registration information is matched from the service registration list according to the client address identifier and the service request identifier, send the service request information to a target backend server corresponding to the service address identifier in the target service registration information, so that the target backend server performs debugging; 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.

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

[0016] the memory, configured to store one or more programs;

[0017] when the one or more programs are executed by the one or more processors, the one or more processors implement the service request forwarding method according to 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 by that the computer program is executed by a processor to implement the service request forwarding method according to the first aspect.

[0019] The embodiment of the application acquires network configuration information, the network configuration information includes at least one piece of service registration information, each piece of service registration information includes a corresponding service address identifier, a registration service identifier and a plurality of 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 to a service registration list; service request information sent by a client is received, the service request information includes a client address identifier and a service request identifier; in the case that 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 a target backend server corresponding to the service address identifier in the target service registration information, so that the target backend server performs forwarding; 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 the gateway to specify the forwarding strategy of a specific service request, 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, which facilitates the user to debug the backend service, so that the result of joint debugging can be directly presented on the computer used for development, the developer can conveniently check the debugging result, and the debugging efficiency is improved. BRIEF DESCRIPTION OF DRAWINGS

[0020] Figure 1 FIG. 1 is a method flowchart of a service request forwarding method provided by an embodiment of the application;

[0021] Figure 2 FIG. 2 is a process schematic diagram of Spring Cloud Gateway realizing network request sending;

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

[0023] Figure 4 FIG. 4 is a process schematic diagram of a service request forwarding method provided by an embodiment of the application;

[0024] Figure 5 FIG. 5 is a process schematic diagram of another service request forwarding method provided by an embodiment of the application;

[0025] Figure 6 FIG. 6 is a structural schematic diagram of a service request forwarding device provided by an embodiment of the application;

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

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

[0028] In the software development process, in order to simulate actual use, it is necessary to send service requests to the gateway, and then the gateway distributes the service requests to the corresponding server. At the same time, in order to facilitate program debugging, it is necessary to forward the specified service request to the local server. However, for service requests, the gateway will distribute the service requests to the appropriate backend server according to the pre-stored distribution strategy, resulting in the possibility that the service request cannot be run on the server required by the user and debugged.

[0029] In view of the problems existing in the prior art mentioned above, the service request forwarding method provided by the embodiments of the present application specifies the forwarding strategy of a specific service request by saving network configuration information 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, facilitates the user to debug the backend service, and makes the result of joint debugging directly presented on the computer used for development, so that the developer can conveniently view the debugging result and improve the debugging efficiency.

[0030] Figure 1 is a method flowchart of a service request forwarding method provided by the embodiments of the present application, as shown in Figure 1 The service request forwarding method is applied to a gateway, and includes but is not limited to steps S110-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 a plurality of 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 the embodiment, the channel for obtaining the network configuration information is not limited, and the network configuration information can be obtained by reading a local database directly, or by data transmission interface or remote communication transmission from other electronic devices and computer systems. After obtaining the network configuration information, data extraction is needed to obtain service registration information of the network configuration information, so that the gateway forwards the debugging service request sent by the client to the target client for debugging in the subsequent.

[0033] In the embodiment, the gateway 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. As shown in Figure 2 The basic process of Spring Cloud Gateway to implement network request sending is shown in FIG. 1. Spring Cloud Gateway is a micro-service gateway based on Spring Framework, which realizes service request routing and processing through the combination of routing configuration and filter chain. When receiving a service request of a gateway client, Spring Cloud Gateway finds a route matched with the service request in Gateway Handler Mapping, and sends it to Gateway WebHandler, and Gateway WebHandler sends the service request to the actual service through the specified filter chain to execute business logic, and then returns the execution result. Figure 2 The filters are separated by a dashed line because the filters can execute business logic before (“pre”) or after (“post”) sending the proxy request. In this way, Spring Cloud Gateway can provide routing, filtering, load balancing and other functions to help simplify service communication and function expansion in micro-service architecture.

[0034] In this embodiment, the gateway, through network configuration information, can process specific service requests. When it receives a service request from a client with a specified IP address, it can forward the service request to a server with that specified IP address for execution and debugging. To achieve the aforementioned forwarding and execution process, this embodiment redefines the network configuration information. The network configuration information includes at least one service registration record. Each service registration record includes a corresponding service address identifier, a registered service identifier, and multiple registration address identifiers. The service address identifier identifies the running device of the corresponding backend service. It can be an IP address, hostname, or other identifier that uniquely identifies the device, indicating the location of the backend service in the network. The registered service identifier uniquely identifies the corresponding backend service. This identifier can be a string or a symbol, uniquely identifying the service throughout the system. The registration address identifier specifies multiple client addresses that initiate the service request. These addresses can be physical addresses, virtual addresses, or the address of the service registry, ensuring that the service request initiated by the specified client can be identified. It is understood that the same service may be initiated by multiple clients; therefore, multiple registration addresses can be configured according to actual needs.

[0035] like Figure 3 The diagram illustrates a test environment architecture provided in this application, including multiple clients (exemplary clients A, B, and C) and multiple servers (exemplary servers A, B, and C). Each client and server is connected to a gateway. Network configuration information can be set through clients or servers in the test environment, or through other terminal devices. For a service registration entry in the network configuration information, service request information from a client with a specified IP address to be registered is required, namely, a registration service identifier and a registration address identifier. The service request requiring forwarding can be determined using the registration service identifier and registration address identifier. Additionally, a target server needs to be configured for the service request according to actual needs, and the IP address of the target server is written into the service registration information. For example, during testing, client A is used to develop front-end software, and server C is used to develop the corresponding back-end software. To simulate real-world usage, client A needs to debug the front-end software and send the generated service requests to server C for a response, allowing back-end software developers on server C to easily view the debugging process. In the prior art, service requests can be based on... Figure 2The network of the illustrated framework performs forwarding, but this forwarding cannot guarantee the directional transmission of the service request transceiver. To meet the above operation requirements, based on the embodiments of the present application, network configuration information can be used, i.e. the user needs to forward the service request B on the client A to the server C for operation and debugging, then the IP address of the client A, the identification of the service request B and the IP address of the server C need to be written in the service registration information. Through these network configuration information, the system can establish the mapping relationship between the service and its running equipment, and provide the ability to confirm and access the backend service for the client or gateway.

[0036] It should be noted that the server in the embodiments of the present application is not a special server in the narrow sense, but can run backend software and can exist in any device form. Compared with another 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 to the service registration list to facilitate the management and maintenance of the registration information of the backend service. Different data structures can be used to implement the service registration list, such as list, set, hash table, etc. The specific choice depends on the demand and the technology stack used. Specifically, a data structure needs to be created first, which contains related fields in the network configuration information, such as registered service identification, service address identification and registered address identification. Then, a data structure of the service registration list is created in the system to save the service registration information. Here, a suitable data structure can be selected according to actual needs, such as list, set or hash table. Then register the service information, when a new service needs to be registered, create a service registration information object and add it to the service registration list, and ensure that the service registration identification is unique in the list. According to the needs, the specific service registration information can be queried and obtained through the registered service identification and registered address identification 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 the service request information sent by the client, the service request information including the client address identification and the service request identification.

[0040] In step S130, the service request information sent by the client needs to be received to obtain the client address identifier and the service request identifier therein. The client address identifier refers to the address identifier of the client initiating the service request. It can be the IP address, host name or other identifier capable of uniquely identifying the client. The client address identifier helps 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 used to uniquely identify a certain service or function in the system. It can be a service name, API endpoint or other identifier capable of uniquely identifying a 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 from a specified IP address, it needs to be forwarded to the server at the specified IP address, and for a general service request that is not specified, the gateway will forward the general service request to the appropriate server for running according to the original request distribution strategy (such as sending the service request to the server with more available resources).

[0041] In step S140, in the case that 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 for forwarding by the target backend 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 saved in the service registration list to determine whether the service request information needs to be forwarded to a specified server. When the service request information sent by the client can be matched with the corresponding result in the service registration list, it means that the service request information is a service information registered in advance for debugging, and therefore the service request information needs to be forwarded to the corresponding specified server. Specifically, in step 130, the service request information is obtained and the client address identifier and the service request identifier are extracted therefrom. Then, 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 correspond to the same, it means that the service request information belongs to the service request for specific testing, 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 accordingly. Subsequently, the service request information sent by the client is forwarded to the backend server corresponding to the target service address identifier for debugging by the user.

[0043] In the method, network configuration information is obtained, the network configuration information includes at least one piece of service registration information, each piece of service registration information includes a corresponding service address identifier, a registration service identifier and a plurality of 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 to a service registration list; service request information sent by a client is received, the service request information includes a client address identifier and a service request identifier; in a case where 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 a target backend server corresponding to the service address identifier in the target service registration information, so that the target backend server performs forwarding; 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 the gateway to specify the forwarding strategy of a specific service request, 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, which facilitates the user to debug the backend service, and makes the result of the joint debugging be directly presented on the computer used for development, so that the developer can conveniently check the debugging result, and the debugging efficiency is improved.

[0044] Reference Figure 4 , Figure 4 is a flowchart of a service request forwarding method provided by an embodiment of the present application. The working process of the embodiment is described below by taking an example that the network configuration file is obtained from a cloud registration database.

[0045] When the user needs to debug, the client related to the test (i.e., client B), the related server request, and the server C running the backend software are recorded in a preset format and uploaded to the cloud registration database. The gateway periodically downloads the network configuration file from the cloud registration database and saves it in the gateway local database. 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 registration service identifier, and a plurality of registration address identifiers. Of course, the gateway can also listen to the network configuration file changes of the cloud registration database and update 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 the gateway receives it, it will compare the identifier 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 the client A and the client C that have not been registered in the cloud registration database, the gateway will select a suitable server from all servers according to the preset allocation strategy and forward it.

[0046] It can be understood that, with reference to Figure 5 , Figure 5 is another flowchart of a service request forwarding method provided by the embodiments of the present application. When the specified IP client address is the same as the specified IP server address (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 running, so as to facilitate the user to perform local debugging operation.

[0047] As an optional implementation manner, the configuration information is saved in the cloud registration database. Correspondingly, the network configuration information is obtained by: according to a preset time interval, obtaining the network configuration information in the cloud registration database.

[0048] In the embodiment, the network configuration information is stored in a cloud registration database which is arranged on a server. When the network configuration information is needed, the server where the cloud registration database is located is accessed to extract the corresponding data. The cloud registration database can be a zookeeper. Specifically, the network configuration information including the service registration information is stored on the zookeeper. The Spring Cloud Gateway service can obtain the network configuration information on the zookeeper and save it to the local memory for access at any time. For the network configuration information, the network configuration information of the cloud registration database can be obtained at a preset time interval to update the local network configuration information. Alternatively, when an update event occurs in the cloud registration database, the corresponding update instruction is generated and sent to the gateway, and the gateway accesses the data of the cloud registration database according to the update instruction to update the local data. Through the 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 to the service registration list in the following manner:

[0050] The client address identifier and the service request identifier are matched 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 correspond to the same, the service registration information is confirmed as the target service registration information.

[0052] In the 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 specified 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, and the service registration list is traversed to match the service registration information one by one. For each service registration information, the client address identifier is matched with the registration address identifier. If the matching is successful, the service request identifier is matched with the registration request identifier. If the service request identifier also matches 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 the identifier matching has no effect on the embodiment, and 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 matched at the same time, and the embodiment is not limited in this regard.

[0053] Through the above matching process, the correct target service address identifier can be determined so as to send the service request information 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, realizing the individual debugging needs of the user.

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

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

[0056] When the registered address identifier and the registered request identifier in the same service registration information in the server registration list are different at least one, generating request failure information;

[0057] Returning 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 saved in the service registration list, so as to determine whether the service request information needs to be forwarded to the specified server. When the client address identifier is the same as the registered address identifier, and the service request type identifier is different from the registered request type identifier, it is indicated that the service request information is not registered in the service registration list, and belongs to a general service request. When the above-mentioned zookeeper is run, the default user needs to perform debugging operation, therefore, the general service request will be distributed to the appropriate server for running according to the distribution strategy preset by the gateway, and on the other hand, the gateway will generate request failure information to remind the user that the service request is not registered, and cannot be sent to the server with the specified IP for running and debugging.

[0059] It can be understood 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, and the user can view all the request responses on the message processing server.

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

[0061] Receiving the forwarding result returned by the target backend server, and sending the forwarding result to the target client.

[0062] In the development process of the backend service software, in order to meet the need of joint debugging with the front-end developers, the embodiment forwards the service request to the specified server, and when the user completes the debugging on the specified server, the gateway obtains the debugging result, forwards the debugging result as the forwarding result to the front-end client, so that the front-end developers can further debug the front-end according to the debugging result of the backend developers.

[0063] In the embodiment, the forwarding result returned by the target backend 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 backend server, which contains service request information and backend server debugging result information. 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 to send the forwarding result to. Then, the forwarding result is sent to the target client corresponding to the forwarding client identifier. This can be achieved through appropriate communication protocols or message passing mechanisms to ensure that the forwarding result reaches the target client. Through these steps, the forwarding result of the target backend 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 backend service or the debugging result of the backend 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 debugging program on the client. The front-end debugging program is the front-end software to be debugged in the development process, and the front-end debugging program can include but is not limited to WebStorm, VSCode and Postman as test tools. When the user needs to debug a certain backend service, the debugging program on the client of the specified IP can be controlled to generate the corresponding service request for debugging.

[0065] Figure 6 is a structural schematic diagram of the service request forwarding device provided by the embodiment of the application. Referring to Figure 5 The service request forwarding device includes an information acquisition module 210, an information saving module 220, a service receiving module 230 and a service forwarding module 240.

[0066] The information acquisition module 210 is configured to acquire network configuration information, the network configuration information including at least one piece of service registration information, each piece of service registration information including a corresponding service address identifier, a registration service identifier, and a plurality of registration address identifiers, the registration service identifier being used to represent a corresponding backend service, and the service address identifier being used to identify a running device of the corresponding backend service.

[0067] On the basis of the above embodiment, the configuration information is saved in a cloud registration database.

[0068] The information acquisition module includes:

[0069] The information acquisition unit is configured to acquire, according to a preset time interval, network configuration information in the cloud registration database.

[0070] On the basis of the above embodiment, the service forwarding module includes:

[0071] The identifier matching unit is configured 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 identifier confirmation unit is configured to, when the registration address identifier and the registration request identifier in the same service registration information in the service registration list are both the same, confirm the service address identifier recorded in the service registration information as the target service address identifier.

[0073] On the basis of the above embodiment, the service request forwarding device further includes:

[0074] The identifier matching module is configured 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.

[0075] The failure information module is configured to, when the registration address identifier and the registration request identifier in the same service registration information in the service registration list are different at least in one, generate request failure information.

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

[0077] On the basis of the above-mentioned embodiments, the service request forwarding device further comprises:

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

[0079] On the basis of the above-mentioned embodiments, the service request information is generated by a front-end debugging program on the client.

[0080] The service request forwarding device provided by the embodiments of the present application is included in an electronic device and can be used to execute any service request forwarding method provided in the above-mentioned embodiments, and has the corresponding functions and advantages.

[0081] It is worth noting that the embodiments of the above-mentioned service request forwarding device include various units and modules only according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy mutual differentiation, and are not used to limit the protection scope of the present application.

[0082] Figure 7 A structural schematic diagram of an electronic device provided by the embodiments of the present application is shown in FIG. 1. Figure 7 As shown in the figure, the electronic device includes a processor 310 and a memory 320, and in a common product form, can further include an input device 330, an output device 340 and a communication device 350; the number of processors 310 in the electronic device can be one or more, Figure 7 and one processor 310 is taken as an example in the middle; 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 through a bus or other means, Figure 7 and a connection through a bus is taken as an example in the middle.

[0083] The memory 320 as a kind of computer readable storage medium can be used to store software programs, computer executable programs and modules, such as program instructions / modules (for example, information acquisition module 210, information saving module 220, service receiving module 230 and service forwarding module 240 in the service request forwarding device) corresponding to the service request forwarding method in the embodiments of the present application. 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, realizes the above-mentioned service request forwarding method.

[0084] The memory 320 can include a program storage area and a data storage area. The program storage area can store an operating system, application programs required for at least one function, etc. The data storage area can store data created according to the use of the electronic device, etc. Furthermore, the memory 320 can include a high-speed random access memory, and can also include a nonvolatile memory such as at least one disk memory device, a flash memory device, or other nonvolatile solid state memory device. In some examples, the memory 320 can further include a memory remotely located with respect to the processor 310, which can be connected to the electronic device through a network. Examples of the 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 can be used to receive network configuration information. The output device 340 can include a display device such as a display screen, etc.

[0086] The electronic device described above includes a forwarding device of a service request, and can be used to execute any forwarding method of a service request, and has corresponding functions and advantages.

[0087] The embodiments of the present application also provide a computer readable storage medium having a computer program stored thereon, which, when executed by an electronic device, implements the related operations in the forwarding method of a service request provided in any of the embodiments of the present application, and has corresponding functions and advantages.

[0088] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product.

[0089] Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) having computer-usable program code embodied in the medium. The present application is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and combinations of flows and / or blocks in the flowcharts and / or block diagrams, 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 apparatus to produce a machine, so that the instructions, which are executed via the processor of the computer or other programmable data processing apparatus, generate a means for implementing the functions specified in the flowcharts and / or block diagrams of the flowcharts and / or block diagrams. These computer program instructions can also be stored in a computer-usable storage medium that can direct a computer or other programmable data processing apparatus to function in a specific manner, such that the instructions stored in the computer-usable storage medium produce a product including an article of manufacture (including a computer program product) storing instructions that implement the functions specified in the flowcharts and / or block diagrams of the flowcharts and / or block diagrams. Figure 1 one flow or multiple flows and / or blocks Figure 1apparatuses that carry out the specified functions of one or more blocks or a combination of blocks. These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the Figure 1 one or more flows and / or blocks Figure 1 one or more blocks or a combination of blocks. These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the Figure 1 one or more flows and / or blocks Figure 1 one or more blocks or a combination of blocks. These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the

[0090] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory. The memory can include non-persistent memory and / or volatile memory, e.g., random access memory (RAM), for storing

[0091] Computer-readable media includes permanent and non-permanent, removable and non-removable media, which can be implemented by any method or technology for storage of information such as 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 disc read-only memory (CD-ROM), digital versatile disc (DVD), or other optical storage, magnetic cassettes, magnetic disks storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to computing devices. According to the definition herein, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.

[0092] It is also to be noted that the terms "comprising", "including", and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises a... " does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0093] Note that the above merely provides the preferred embodiments of the present application and the principles of the applied technology. It is understood by those skilled in the art that the present application is not limited to the specific embodiments herein, and that various obvious changes, re-adjustments, and substitutions can be made by those skilled in the art without departing from the scope of the present application. Therefore, although the present application has been described in detail through the above embodiments, the present application is not limited to the above embodiments, and can 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 service requests, applied to a gateway, characterized in that, include: Obtain network configuration information, which includes 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. The registered service identifier is used to represent the corresponding backend service, the service address identifier is used to identify the running device of the corresponding backend service, and the registered address identifier is used to identify multiple client addresses that initiate the service request. Save the service registration information to the service registration list; Receive service request information sent by the client, the service request information including the client address identifier and the service request identifier; If a 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 backend server corresponding to the service address identifier in the target service registration information for debugging by the target backend server; the registration address identifier and registration service identifier in the target service registration information are matched with the client address identifier and service request identifier, respectively.

2. The service request forwarding method according to claim 1, characterized in that, The configuration information is stored in the cloud registration database; The acquisition of network configuration information includes: The network configuration information is retrieved from the cloud registration database at preset time intervals.

3. The service request forwarding method according to claim 1, characterized in that, The target service registration information was matched in the following way: The client address identifier and the service request identifier are matched with the registration address identifier and registration request identifier recorded in the service registration list, respectively. If the registration address identifier and registration request identifier in the same service registration information in the service registration list are identical, then the service registration information is confirmed as the target service registration information.

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

5. The service request forwarding method 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 process 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 service request forwarding method according to claim 1, characterized in that, The service request information is generated by the front-end debugging program on the client.

7. A service request forwarding device, applied to a gateway, characterized in that, include: The information acquisition module is used to acquire network configuration information, which includes 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. The registered service identifier is used to represent the corresponding backend service, the service address identifier is used to identify the running device of the corresponding backend service, and the registered address identifier is used to identify multiple client addresses that initiate the service request. An information storage module is used to save the service registration information to a service registration list; The service receiving module is used to receive service request information sent by the client, the service request information including the client address identifier and the service request identifier; 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 perform debugging; the registration address identifier and registration service identifier in the target service registration information are matched with the client address identifier and service request identifier, respectively.

8. The service request forwarding apparatus according to claim 7, characterized in that, The configuration information is stored in the cloud registration database; The information acquisition module includes: 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; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the electronic device implements the service request forwarding method as described in any one of claims 1-6.

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

Citation Information

Patent Citations

  • Method and device used for debugging microservice

    CN109150978A

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

    CN114205342A