A service request processing system, method and device

Through the combination of request scheduler, request adapter and data converter, the problem of high coupling between business code and interface differentiated code in the prior art is solved, and the decoupling of code and unified interface processing is realized, which supports the rapid growth of business and the maintenance of the system.

CN113760444BActive Publication Date: 2025-04-15BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011321426.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-23
Publication Date
2025-04-15
Estimated Expiration
2040-11-23

AI Technical Summary

Technical Problem

When the existing technology is differentiated in processing interfaces, the business code and the differentiated code of the processing interfaces are highly coupled, resulting in poor code readability, inaccurate positioning problems, and cannot support the rapid growth of the business and the later upgrade or maintenance of the system.

Method used

The combination scheme of request scheduler, request adapter and data converter is adopted to abstract and underlying conversion processes, decouple business code from processing differential code, and achieve differentiated isolation and unified processing of multiple target business system interfaces.

Benefits of technology

It realizes the cleanliness of business code and the purity of business processes, while taking into account the robustness, richness and versatility of component architecture, supports the rapid growth of business, and facilitates the later upgrade or maintenance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760444B_ABST
    Figure CN113760444B_ABST
Patent Text Reader

Abstract

The present invention discloses a system, method and device for processing a business request, and relates to the field of computer technology. The system includes: a request scheduler, a request adapter and a data converter, wherein the request scheduler is used to monitor business requests; a request adapter is allocated to the business request according to a business identifier; and a standard response result returned by the request adapter is received; a request adapter is used to receive business requests and send standard request parameters to the data converter; a differentiated request parameter returned by the data converter is received and a differentiated business request is generated; the differentiated business request is sent to a target business system for business processing and a differentiated response result is obtained; the differentiated response result is sent to the data converter and a standard response result is received; the data converter is used to convert the standard request parameter into a differentiated request parameter; and the differentiated response result is converted into a standard response result. The system can be applicable to scenarios with differentiated interfaces.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a system, method and device for processing a business request. Background Art

[0002] With the development of the business chain, some projects, as distribution roles, will connect to multiple suppliers; some projects, as supply roles, will connect to multiple distributors. The business systems corresponding to different suppliers or distributors have their own unique business processing procedures and business request access interfaces. For different business systems, different interfaces require different request parameters and formats, which leads to interface differentiation.

[0003] At present, the solution for interface differentiation is mostly to provide services through flat interfaces and handle interface differentiation through flat codes. The code uses judgment statements such as if-else and when to determine which business system interface needs to be called.

[0004] However, in the current solution for interface differentiation, the business code is highly coupled with the code for handling interface differentiation; the large number of interfaces causes the code to grow exponentially; judgment statements are used to make interface calls, the code is poorly readable, and the location is imprecise when problems occur. Summary of the invention

[0005] In view of this, the embodiments of the present invention provide a system, method and device for processing business requests, which can abstract and underlying the conversion process in the scenario of interface differentiation, decouple the business code from the processing difference code, while ensuring the cleanliness of the business code and business process, taking into account the robustness, richness and universality of the component architecture, and can well isolate the differentiated implementations of multiple target business system interfaces, facilitate accurate positioning when problems arise, support the rapid growth of business, and facilitate subsequent upgrades or maintenance of the system.

[0006] To achieve the above objective, according to one aspect of an embodiment of the present invention, a system for processing a service request is provided.

[0007] A business request processing system includes: a request scheduler, a request adapter and a data converter, wherein:

[0008] The request scheduler is used to monitor a service request, wherein the service request includes a standard request parameter and a service identifier; allocate a request adapter to the service request according to the service identifier; and receive a standard response result returned by the request adapter;

[0009] The request adapter is used to receive the assigned business request and send the standard request parameters to the data converter; receive the differentiated request parameters returned by the data converter and generate a differentiated business request according to the differentiated request parameters; send the differentiated business request to the target business system for business processing and obtain a differentiated response result; send the differentiated response result to the data converter and receive the standard response result returned by the data converter;

[0010] The data converter is used to convert the standard request parameters into the differentiated request parameters; and to convert the differentiated response results into the standard response results.

[0011] Optionally, the data converter is further used for:

[0012] The differential request parameters are encrypted and a signature is constructed, and the differential response result is signature verified and decrypted.

[0013] Optionally, the service request further includes a service system identifier, and the request adapter is further used for:

[0014] After generating a differentiated service request according to the differentiated request parameters, a target service system is determined according to the service system identifier, so as to send the differentiated service request to the target service system for service processing.

[0015] Optionally, the service request further includes a service system identifier, and the request scheduler is further configured to:

[0016] In response to a container startup operation, a registered request adapter is obtained from the container, and a request adapter mapping table is established with an index constructed by the request adapter as a key name and a request adapter identifier as a key value, wherein the index includes a business identifier and a business system identifier;

[0017] Allocate a request adapter for the service request according to the service identifier, the service system identifier and the request adapter mapping table;

[0018] The request adapter is also used to:

[0019] In response to the container startup operation, an index is constructed according to the corresponding service identifier and service system identifier, and registration is performed with the container according to the index.

[0020] According to another aspect of an embodiment of the present invention, a method for processing a service request is provided.

[0021] A method for processing a business request, comprising:

[0022] Obtaining a service request, wherein the service request includes standard request parameters and a service identifier;

[0023] Allocating a request adapter to the service request according to the service identifier, so as to convert the standard request parameters into differentiated request parameters through the request adapter, and generating a differentiated service request according to the differentiated request parameters;

[0024] Sending the differentiated service request to the target service system for service processing, and obtaining a differentiated response result from the target service system;

[0025] The differentiated response result is converted into a standard response result and returned.

[0026] Optionally, when converting the standard request parameters into differentiated request parameters, encrypting the differentiated request parameters and constructing a signature;

[0027] When converting the differential response result into a standard response result, the differential response result is signature verified and decrypted.

[0028] Optionally, the service request further includes a service system identifier, and before the step of sending the differentiated service request to the target service system for service processing, the step further includes:

[0029] The target business system is determined according to the business system identifier.

[0030] Optionally, the service request further includes a service system identifier, and before the step of allocating a request adapter for the service request according to the service identifier, the step further includes:

[0031] In response to a container startup operation, a registered request adapter is obtained from the container, and a request adapter mapping table is established with an index constructed by the request adapter as a key name and a request adapter identifier as a key value, wherein the index includes a business identifier and a business system identifier;

[0032] The step of allocating a request adapter for the service request according to the service identifier comprises:

[0033] A request adapter is allocated to the service request according to the service identifier, the service system identifier and the request adapter mapping table.

[0034] According to yet another aspect of an embodiment of the present invention, a device for processing a service request is provided.

[0035] A device for processing a service request, comprising:

[0036] A request acquisition module, used to acquire a service request, wherein the service request includes standard request parameters and a service identifier;

[0037] A request conversion module, configured to allocate a request adapter to the service request according to the service identifier, so as to convert the standard request parameters into differentiated request parameters through the request adapter, and generate differentiated service requests according to the differentiated request parameters;

[0038] A response acquisition module, used to send the differentiated service request to the target service system for service processing, and obtain the differentiated response result of the target service system;

[0039] The response conversion module is used to convert the differentiated response result into a standard response result and return it.

[0040] Optionally, when converting the standard request parameters into differentiated request parameters, the request conversion module is further used to encrypt the differentiated request parameters and construct a signature;

[0041] When converting the differential response result into a standard response result, the response conversion module is further used to perform signature verification and decryption on the differential response result.

[0042] Optionally, the response acquisition module is further configured to, when the business request further includes a business system identifier, determine a target business system according to the business system identifier before sending the differentiated business request to the target business system for business processing.

[0043] Optionally, the service request further includes a service system identifier, and the device further includes a mapping table maintenance module, which is used to:

[0044] Before the step of assigning a request adapter to the service request according to the service identifier, in response to a container startup operation, a registered request adapter is obtained from the container, and a request adapter mapping table is established with an index constructed by the request adapter as a key name and the request adapter identifier as a key value, wherein the index includes a service identifier and a service system identifier;

[0045] Furthermore, the request conversion module is further used for:

[0046] A request adapter is allocated to the service request according to the service identifier, the service system identifier and the request adapter mapping table.

[0047] According to yet another aspect of an embodiment of the present invention, an electronic device for processing a service request is provided.

[0048] An electronic device for processing business requests, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the business request processing method provided by an embodiment of the present invention.

[0049] According to yet another aspect of an embodiment of the present invention, a computer readable medium is provided.

[0050] A computer readable medium stores a computer program, which, when executed by a processor, implements a method for processing a service request provided by an embodiment of the present invention.

[0051] An embodiment of the above invention has the following advantages or beneficial effects: a system for processing business requests is provided, including a request scheduler, a request adapter and a data converter, wherein the request scheduler is used to monitor business requests, the business requests include standard request parameters and business identifiers; allocate request adapters to business requests according to the business identifiers; and receive standard response results returned by the request adapters; the request adapter is used to receive the allocated business requests and send the standard request parameters to the data converter; receive differentiated request parameters returned by the data converter, and generate differentiated business requests according to the differentiated request parameters; send the differentiated business requests to the target business system for business processing, and obtain differentiated response results; and send the differentiated response results to the target business system. Send to the data converter, and receive the standard response result returned by the data converter; the data converter is used to convert standard request parameters into differentiated request parameters; and, convert differentiated response results into standard response results, realizing business request processing based on three core components: request scheduler, request adapter, and data converter. In the scenario of interface differentiation, the conversion process is abstracted and underlying, and the business code is decoupled from the processing difference code. While ensuring the cleanliness of business code and business process, the component architecture is robust, rich and universal, and can well isolate the differentiated implementation of multiple target business system interfaces, which is easy to accurately locate when problems occur. It can support the rapid growth of business and is convenient for later upgrades or maintenance of the system.

[0052] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0054] Figure 1 is a schematic diagram of the architecture of a business request processing system according to an embodiment of the present invention;

[0055] Figure 2 It is a schematic diagram of the implementation principle of a business request processing system according to an embodiment of the present invention;

[0056] Figure 3 It is a flowchart of a request adapter performing differentiated processing according to an embodiment of the present invention;

[0057] Figure 4 is a schematic diagram of an assembly process of a request adapter according to an embodiment of the present invention;

[0058] Figure 5 is a schematic diagram of main steps of a method for processing a service request according to an embodiment of the present invention;

[0059] Figure 6 is a schematic diagram of a processing flow of a service request according to an embodiment of the present invention;

[0060] Figure 7 is a schematic diagram of main modules of a device for processing a service request according to an embodiment of the present invention;

[0061] Figure 8 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0062] Fig. 9 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0063] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0064] At present, in various projects, such as train tickets and air tickets, there is such a scenario. Some projects, as distribution roles, will connect to multiple suppliers. Some projects, as supply roles, will connect to multiple distributors. Whether the project connects to suppliers or distributors, we uniformly call them target stations, and the target station corresponds to the target business system.

[0065] It is a common scenario that the same business process needs to connect to multiple target stations. If the train ticket client system, air ticket distribution system, hotel system, ticket system, etc. are used as distribution roles, they need to connect to multiple supply target stations. If the train ticket supply chain system, air ticket supply chain system, etc. are used as supply roles, they need to connect to multiple distribution target stations. In this scenario, the interface rules between multiple target stations are not unified, mainly in four aspects: request address, request method, request parameters, and request format. For example: for the same business process, the 'order number' field of target station 1 is named 'orderId', and the request format is JSON format; the 'order number' field of target station 2 is named 'merchantId', and the request format is form format. We call this kind of inconsistent interface rules of multiple target stations interface differentiation.

[0066] In the process of investigating the solution of interface differentiation in the above scenario, it is roughly summarized as flat interface to provide services, flat code to handle interface differentiation, and use if else and other process control statements to determine which target station interface needs to be called. Or use patterns to perform preliminary code encapsulation. However, these solutions generally have the following defects:

[0067] 1. High business coupling, violating the single responsibility principle: the business code is highly coupled with the code that handles interface differentiation, making the overall code bloated;

[0068] 2. Huge number of interfaces: Although the solution of flattening interfaces complies with the principle of interface isolation, the number of interfaces increases in the form of "business process" multiplied by "access target station";

[0069] 3. Use more flow control statements such as if else to make judgments: This makes the code less readable and the problem location is not accurate when it occurs.

[0070] In short, it can be imagined that the system implementation code is densely packed with interfaces and densely packed if else process control statements. This is a very bad coding style. It cannot support the rapid growth of the business and is not conducive to the later upgrade or maintenance of the system.

[0071] In view of the above-mentioned defects of the prior art, the present invention aims to propose a universal component or solution that is scenario-universal, code decoupled and atomized, module-reusable, interface-isolated, and differentiated processing-based.

[0072] Scenarios that are universal: The technical solution of the present invention is not only applicable to scenarios of multiple distributions or multiple supplies, but can also be directly used in other scenarios where one business process corresponds to multiple target stations and the interface rules of multiple target stations are inconsistent;

[0073] Code decoupling: Decouple business code from interface differentiation processing code. During the development process, developers can develop business code and interface code in parallel.

[0074] Module atomization and reuse: According to functional responsibilities, each module is refined, abstracted, combined, and reused to meet most processing flows and achieve the purpose of universal solution;

[0075] Interface isolation: Although the number of interfaces has not changed and is still increasing exponentially, the decoupling of business code from interface code facilitates sub-package management. And through module combination, plug-and-play is achieved, and unplug and stop is achieved;

[0076] Differences are implemented at the bottom layer: The abstract process and code for handling interface differences are handed over to the bottom layer of this solution. The business layer does not care about the bottom layer implementation, ensuring that the business code is clean and clear.

[0077] According to one aspect of the present invention, a system for processing a service request is provided. Figure 1 Schematic diagram of the architecture of a business request processing system according to an embodiment of the present invention. Figure 1 As shown, the service request processing system 100 according to the embodiment of the present invention mainly includes three roles or modules: a request scheduler 101 , a request adapter 102 , and a data converter 103 .

[0078] The request scheduler 101 is used to monitor the service request, which includes standard request parameters and service identifiers; allocate a request adapter to the service request according to the service identifier; and receive a standard response result returned by the request adapter;

[0079] The request adapter 102 is used to receive the assigned business request and send the standard request parameters to the data converter; receive the differentiated request parameters returned by the data converter, and generate a differentiated business request according to the differentiated request parameters; send the differentiated business request to the target business system for business processing, and obtain a differentiated response result; send the differentiated response result to the data converter, and receive the standard response result returned by the data converter;

[0080] The data converter 103 is used to convert the standard request parameters into the differentiated request parameters; and to convert the differentiated response results into the standard response results.

[0081] According to the service request processing system of the embodiment of the present invention, in the scenario of interface differentiation, the service code can be abstracted and bottom-layered to decouple the service code from the processing difference code. While ensuring the cleanliness of the service code and service process, the component architecture is robust, rich and universal, and the differentiated implementation of multiple target station interfaces can be well isolated.

[0082] According to an embodiment of the present invention, the data converter 103 is further used to: encrypt the differential request parameters and construct a signature, and perform signature verification and decryption on the differential response results.

[0083] According to another embodiment of the present invention, the service request further includes a service system identifier, and the request adapter 102 is further configured to:

[0084] After generating a differentiated service request according to the differentiated request parameters, the target service system is determined according to the service system identifier, so as to send the differentiated service request to the target service system for service processing.

[0085] According to another embodiment of the present invention, the service request further includes a service system identifier, and the request scheduler 101 may also be used to:

[0086] In response to the container start operation, a registered request adapter is obtained from the container, and a request adapter mapping table is established with an index constructed by the request adapter as a key name and a request adapter identifier as a key value, wherein the index includes a business identifier and a business system identifier;

[0087] Allocate a request adapter for a business request according to the business identifier, the business system identifier and the request adapter mapping table;

[0088] The request adapter 102 may also be used to:

[0089] In response to the container startup operation, an index is constructed according to the corresponding service identifier and service system identifier, and the index is registered with the container.

[0090] The implementation principle of the service request processing system of the present invention is introduced below in conjunction with specific embodiments. Figure 2 FIG. 1 is a schematic diagram showing the implementation principle of a business request processing system according to an embodiment of the present invention. Figure 2 As shown, a business request processing system includes 4 request adapters, and each request adapter corresponds to a target business system. After receiving the business request from the client system, the business request processing system obtains the request parameters and the index of the request adapter from the business request; then matches the request to the business request according to the index, and the request adapter calls the request converter to convert the request, and then sends the converted business request to the target business system. After receiving the response from the target business system, the response result is converted by the response converter, and then the converted result is returned to the request adapter, and finally returned to the client system.

[0091] In an embodiment of the present invention, the request dispatcher RequestDispatcher is used to centrally manage request adapters, in which a "request adapter mapping table" is maintained. The request dispatcher implements an application listening interface ApplicationListener interface, and executes the application event listening method onApplicationEvent() method after the application is started to obtain all registered request adapters from the application container. Then, the index constructed by the request adapter is used as the key name, and the identifier of the request adapter itself is used as the key value, which is saved in the request adapter mapping table to establish a mapping. This process is called: assembly of the request adapter.

[0092] In the Java R&D system, the backend web project is often implemented using the Spring architecture. The backend application can be regarded as a container (Spring container), and the request adapter, data converter, etc. mentioned in the embodiment are all beans in the container (which can be understood as an operation class). The ApplicationListener class is a container listener. When the entire application container is started, the listening method onApplicationEvent() in this class will be executed. This method is a container listening method and is executed after the application container is started. This method mainly obtains all request adapters from the application container, and then obtains the index of each request adapter, establishes a request adapter mapping table (ADAPTER_TABLE), and stores the mapping table in the request scheduler, which is managed uniformly by the request scheduler.

[0093] According to an embodiment of the present invention, after each request adapter RequestAdapter is started, an index is constructed through the index() method, which corresponds to the request adapter one by one. When the business is specifically implemented, the index is composed of "business identifier + business system identifier", for example, and can correspond to a unique business process and a unique business system. According to the index constructed by the request adapter and the identifier of the request adapter, the request adapter mapping table can be implemented based on Map.

[0094] In an embodiment of the present invention, the data converter is embedded in the request adapter, and is used to convert the input source data into the output target data. In addition, the data converter can also support customized development, such as: building signatures, parameter encryption, verifying signatures, response decryption, etc.

[0095] Figure 3 FIG. 1 is a flow chart of a request adapter performing differentiated processing according to an embodiment of the present invention. Figure 3 As shown, in the embodiment of the present invention, four types of data and two data converters are defined in the request adapter. The four types of data are:

[0096] SID (source input data): original input data, in Figure 3 In the example, the standard request parameters included in the business request are:

[0097] TID (target input data): new input data, in Figure 3 In the example, the following are: Differentiated request parameters of the target business system;

[0098] SOD (source output data): original output data, in Figure 3 In the example, it is: the differentiated response results output by the target business system.

[0099] TOD (target output data): new output data, in Figure 3 In the example, it is: the standard response result returned to the request adapter.

[0100] Two data converters: input converter and output converter. The request adapter converts standard request parameters into differentiated request parameters through the input converter, and converts differentiated response results into standard response results through the output converter.

[0101] The request adapter in the embodiment of the present invention implements okhttp by default, supports sending http requests, supports common request methods such as post and get, and supports common data formats such as forms and JSON. The request adapter supports customized extensions, such as common requirements such as interface idempotence and message retention. Among them, okhttp is a component commonly used in applications for two parties to interact with each other through interfaces. It is implemented based on http and is more efficient than http.

[0102] Figure 4 The figure is a schematic diagram of the assembly process of the request adapter of an embodiment of the present invention. The method for processing the service request of the present invention is divided into two stages during the implementation process, the first part is the startup stage, and the second part is the execution stage. The startup stage can be considered as a stage of resource preparation. As the application starts, the content in the request scheduler is gradually improved, that is, the assembly process of the request adapter is performed.

[0103] like Figure 4As shown in the figure, when the application starts, the Spring container will be loaded, and then all request adapters will be registered in the container. Because the business request processing system of the present invention is implemented based on Spring, it is necessary to annotate the request adapter with @Component or<bean class="xx.XxxAdapter" / > Register with the Spring container. When the Spring container is started, the request scheduler's listening event method is executed: onApplicationEvent() method. The request scheduler obtains the request adapter registered in the Spring container and assembles the request adapter through the index constructed by the request adapter.

[0104] The execution phase can be understood as a phase of business process execution, that is, the execution phase of the business request processing method of the present invention.

[0105] According to another aspect of the present invention, a method for processing a service request is provided. Figure 5 FIG. 1 is a schematic diagram of the main steps of the method for processing a service request according to an embodiment of the present invention. Figure 5 As shown, the method for processing a service request in the embodiment of the present invention mainly includes the following steps S501 to S504.

[0106] Step S501: Obtain a service request, wherein the service request includes standard request parameters and a service identifier;

[0107] Step S502: allocating a request adapter to the service request according to the service identifier, so as to convert the standard request parameters into differentiated request parameters through the request adapter, and generating a differentiated service request according to the differentiated request parameters;

[0108] Step S503: sending the differentiated service request to the target service system for service processing, and obtaining a differentiated response result from the target service system;

[0109] Step S504: convert the differentiated response result into a standard response result and return it.

[0110] According to one embodiment of the present invention, when converting the standard request parameters into differentiated request parameters, the differentiated request parameters are encrypted and a signature is constructed;

[0111] When converting the differential response result into a standard response result, the differential response result is signature verified and decrypted.

[0112] According to another embodiment of the present invention, the service request further includes a service system identifier, and before the step of sending the differentiated service request to the target service system for service processing, the step further includes:

[0113] The target business system is determined according to the business system identifier.

[0114] According to another embodiment of the present invention, the service request further includes a service system identifier, and before the step of allocating a request adapter for the service request according to the service identifier, the step further includes:

[0115] In response to a container startup operation, a registered request adapter is obtained from the container, and a request adapter mapping table is established with an index constructed by the request adapter as a key name and a request adapter identifier as a key value, wherein the index includes a business identifier and a business system identifier;

[0116] The step of allocating a request adapter for the service request according to the service identifier comprises:

[0117] A request adapter is allocated to the service request according to the service identifier, the service system identifier and the request adapter mapping table.

[0118] The following describes the processing flow of the service request of the present invention in conjunction with specific embodiments. Figure 6 FIG. 1 is a schematic diagram of a process flow of a service request according to an embodiment of the present invention. Figure 6 As shown, the processing flow of the service request in the embodiment of the present invention mainly includes the following steps:

[0119] 1. The business request processing system receives the business request from the client system through the business RPC interface, and executes the doDispatcher() method to trigger the request dispatcher to process the business request. The input parameters of this method are the index of the request adapter and the standard request parameters involved in the business line, and the output parameters are the standard response results of the business line;

[0120] 2. The request scheduler obtains the corresponding request adapter through the request adapter mapping table according to the index of the input parameter;

[0121] 3. The request scheduler calls the request adapter by executing the adaptation method doAdapter() to make the request adapter process the business request. The input parameter of this method is the standard request parameter of the business line, and the output parameter is the standard response result of the business line.

[0122] 4. The request adapter calls the doConverter() method of the data converter to convert the business request parameters. The input parameter of this method is the standard request parameter of the business line, and the output parameter is the differentiated request parameter of the target business system.

[0123] 5. The data converter converts the standard request parameters of the business line into the differentiated request parameters of the target business system, during which functions such as signature construction and parameter encryption can be customized;

[0124] 6. The request adapter generates differentiated business requests by building requests through subclasses according to the differentiated request parameters returned by the data converter, and sends the differentiated business requests to the target business system through the okhttp tool;

[0125] 7. The target business system processes the differentiated business request, generates a differentiated response result and returns it to the request adapter;

[0126] 8. The request adapter calls the doConverter() method of the data converter again to convert the corresponding results. The input parameter of this method is the differentiated response result returned by the target business system, and the output parameter is the standard response result of the business line.

[0127] 9. The data converter converts the differentiated response results of the target business system into the standard response results of the business line, during which functions such as signature verification and parameter decryption can be customized;

[0128] 10. The request adapter receives the standard response result returned by the data converter, and returns the standard response result to the upstream business RPC interface through the request scheduler, and further returns it to the client system.

[0129] According to yet another aspect of the present invention, a device for processing a service request is provided. Figure 7 FIG. 1 is a schematic diagram of the main modules of a device for processing a service request according to an embodiment of the present invention. Figure 7 As shown, the service request processing device 700 of the embodiment of the present invention mainly includes a request acquisition module 701, a request conversion module 702, a response acquisition module 703 and a response conversion module 704.

[0130] The request acquisition module 701 is used to acquire a service request, wherein the service request includes standard request parameters and a service identifier;

[0131] A request conversion module 702, configured to allocate a request adapter to the service request according to the service identifier, so as to convert the standard request parameters into differentiated request parameters through the request adapter, and generate differentiated service requests according to the differentiated request parameters;

[0132] The response acquisition module 703 is used to send the differentiated service request to the target service system for service processing, and obtain the differentiated response result of the target service system;

[0133] The response conversion module 704 is used to convert the differentiated response result into a standard response result and return it.

[0134] According to an embodiment of the present invention, when converting the standard request parameters into the differentiated request parameters, the request conversion module 702 is further used to encrypt the differentiated request parameters and construct a signature;

[0135] When converting the differential response result into a standard response result, the response conversion module 704 is also used to perform signature verification and decryption on the differential response result.

[0136] According to another embodiment of the present invention, the response acquisition module 703 is further used to determine the target business system according to the business system identifier before sending the differentiated business request to the target business system for business processing, when the business request also includes a business system identifier.

[0137] According to another embodiment of the present invention, the service request further includes a service system identifier, and the service request processing device 700 of the embodiment of the present invention further includes a mapping table maintenance module (not shown in the figure) for:

[0138] Before the step of assigning a request adapter to the service request according to the service identifier, in response to a container startup operation, a registered request adapter is obtained from the container, and a request adapter mapping table is established with an index constructed by the request adapter as a key name and the request adapter identifier as a key value, wherein the index includes a service identifier and a service system identifier;

[0139] In addition, the request conversion module 702 is also used for:

[0140] A request adapter is allocated to the service request according to the service identifier, the service system identifier and the request adapter mapping table.

[0141] According to the technical solution of an embodiment of the present invention, a system for processing business requests is provided, including a request scheduler, a request adapter and a data converter, wherein the request scheduler is used to monitor business requests, the business requests include standard request parameters and business identifiers; allocate request adapters to business requests according to the business identifiers; and receive standard response results returned by the request adapters; the request adapters are used to receive allocated business requests and send the standard request parameters to the data converter; receive differentiated request parameters returned by the data converter, and generate differentiated business requests according to the differentiated request parameters; send differentiated business requests to the target business system for business processing, and obtain differentiated response results; send differentiated response results to the data converter; The data converter receives the standard response result returned by the data converter; the data converter is used to convert the standard request parameters into differentiated request parameters; and the differentiated response results are converted into standard response results. The business request processing is realized based on the three core components of the request scheduler, the request adapter, and the data converter. In the scenario of interface differentiation, the conversion process is abstracted and underlying, and the business code is decoupled from the processing difference code. While ensuring the cleanliness of the business code and business process, the component architecture is robust, rich and universal, and can well isolate the differentiated implementation of multiple target business system interfaces, which is easy to accurately locate when problems occur. It can support the rapid growth of the business and is convenient for later upgrades or maintenance of the system.

[0142] Figure 8 An exemplary system architecture 800 is shown to which the method for processing a service request or an apparatus and system for processing a service request according to an embodiment of the present invention can be applied.

[0143] like Figure 8 As shown, system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. Network 804 is used to provide a medium for communication links between terminal devices 801, 802, 803 and server 805. Network 804 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0144] Users can use terminal devices 801, 802, 803 to interact with server 805 through network 804 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 801, 802, 803, such as shopping applications, travel applications, real estate agency applications, etc. (only examples).

[0145] The terminal devices 801 , 802 , and 803 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0146] The server 805 may be a server that provides various services, such as a background management server (only for example) that provides support for business processing requests sent by users using terminal devices 801, 802, and 803. The background management server may allocate a request adapter to the received business request and other data, so as to convert the standard request parameters into differentiated request parameters through the request adapter, and generate differentiated business requests according to the differentiated request parameters; send the differentiated business requests to the target business system for business processing, and obtain differentiated response results of the target business system; convert the differentiated response results into standard response results, and feed back the processing results (such as standard response results - only for example) to the terminal device.

[0147] It should be noted that the method for processing the service request provided in the embodiment of the present invention is generally executed by the server 805 , and accordingly, the device or system for processing the service request is generally set in the server 805 .

[0148] It should be understood that Figure 8 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.

[0149] Reference below Fig. 9 , which shows a schematic diagram of the structure of a computer system 900 of a terminal device or a server suitable for implementing an embodiment of the present invention. Fig. 9 The terminal device or server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0150] like Fig. 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the system 900 are also stored. The CPU 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0151] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage section 908 as needed.

[0152] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the above-mentioned functions defined in the system of the present invention are executed.

[0153] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0154] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0155] The units or modules involved in the embodiments of the present invention may be implemented by software or hardware. The units or modules described may also be arranged in a processor. For example, they may be described as: a processor includes a request acquisition module, a request conversion module, a response acquisition module, and a response conversion module. The names of these units or modules do not, in some cases, constitute limitations on the units or modules themselves. For example, the request acquisition module may also be described as a "module for acquiring business requests."

[0156] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining a business request, the business request includes a standard request parameter and a business identifier; allocating a request adapter to the business request according to the business identifier, so as to convert the standard request parameter into a differentiated request parameter through the request adapter, and generate a differentiated business request according to the differentiated request parameter; sending the differentiated business request to the target business system for business processing, and obtaining the differentiated response result of the target business system; converting the differentiated response result into a standard response result and returning it.

[0157] According to the technical solution of an embodiment of the present invention, a system for processing business requests is provided, including a request scheduler, a request adapter and a data converter, wherein the request scheduler is used to monitor business requests, the business requests include standard request parameters and business identifiers; allocate request adapters to business requests according to the business identifiers; and receive standard response results returned by the request adapters; the request adapters are used to receive allocated business requests and send the standard request parameters to the data converter; receive differentiated request parameters returned by the data converter, and generate differentiated business requests according to the differentiated request parameters; send differentiated business requests to the target business system for business processing, and obtain differentiated response results; send differentiated response results to the data converter; The data converter receives the standard response result returned by the data converter; the data converter is used to convert the standard request parameters into differentiated request parameters; and the differentiated response results are converted into standard response results. The business request processing is realized based on the three core components of the request scheduler, the request adapter, and the data converter. In the scenario of interface differentiation, the conversion process is abstracted and underlying, and the business code is decoupled from the processing difference code. While ensuring the cleanliness of the business code and business process, the component architecture is robust, rich and universal, and can well isolate the differentiated implementation of multiple target business system interfaces, which is easy to accurately locate when problems occur. It can support the rapid growth of the business and is convenient for later upgrades or maintenance of the system.

[0158] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A system for processing business requests, characterized in that: include: Request scheduler, request adapter and data converter, where: The request scheduler is used to monitor a service request, wherein the service request includes a standard request parameter and a service identifier; allocate a request adapter to the service request according to the service identifier; and receive a standard response result returned by the request adapter; The request adapter is used to receive the assigned business request and send the standard request parameters to the data converter; receive the differentiated request parameters returned by the data converter and generate a differentiated business request according to the differentiated request parameters; send the differentiated business request to the target business system for business processing and obtain a differentiated response result; send the differentiated response result to the data converter and receive the standard response result returned by the data converter; The data converter is used to convert the standard request parameters into the differentiated request parameters; and convert the differentiated response results into the standard response results; The service request also includes a service system identifier. The request scheduler is further used to: in response to a container startup operation, obtain a registered request adapter from the container, and establish a request adapter mapping table using an index constructed by the request adapter as a key name and a request adapter identifier as a key value, wherein the index includes a business identifier and a business system identifier; and allocate a request adapter to the business request according to the business identifier, the business system identifier and the request adapter mapping table; The request adapter is further used to: in response to a container startup operation, construct an index according to the corresponding service identifier and service system identifier, and register with the container according to the index.

2. The processing system according to claim 1, characterized in that The data converter is also used for: The differential request parameters are encrypted and a signature is constructed, and the differential response result is signature verified and decrypted.

3. The processing system according to claim 1, characterized in that The service request also includes a service system identifier, and the request adapter is further used for: After generating a differentiated service request according to the differentiated request parameters, a target service system is determined according to the service system identifier, so as to send the differentiated service request to the target service system for service processing.

4. A method for processing a business request, characterized in that: include: Obtaining a service request, wherein the service request includes standard request parameters and a service identifier; Allocating a request adapter to the service request according to the service identifier, so as to convert the standard request parameters into differentiated request parameters through the request adapter, and generating a differentiated service request according to the differentiated request parameters; Sending the differentiated service request to the target service system for service processing, and obtaining a differentiated response result from the target service system; Convert the differentiated response result into a standard response result and return it; The service request also includes a service system identifier. Before the step of assigning a request adapter to the service request according to the service identifier, the method further includes: in response to a container startup operation, obtaining a registered request adapter from the container, and establishing a request adapter mapping table with an index constructed by the request adapter as a key name and the request adapter identifier as a key value, wherein the index includes a service identifier and a service system identifier; The step of allocating a request adapter to the service request according to the service identifier includes: allocating a request adapter to the service request according to the service identifier, the service system identifier and the request adapter mapping table.

5. The processing method according to claim 4, characterized in that: When converting the standard request parameters into differentiated request parameters, encrypting the differentiated request parameters and constructing a signature; When converting the differential response result into a standard response result, the differential response result is signature verified and decrypted.

6. The processing method according to claim 4, characterized in that: The service request also includes a service system identifier, and before the step of sending the differentiated service request to the target service system for service processing, the step further includes: The target business system is determined according to the business system identifier.

7. A device for processing a service request, characterized in that: include: A request acquisition module, used to acquire a service request, wherein the service request includes standard request parameters and a service identifier; A request conversion module, configured to allocate a request adapter to the service request according to the service identifier, so as to convert the standard request parameters into differentiated request parameters through the request adapter, and generate differentiated service requests according to the differentiated request parameters; A response acquisition module, used to send the differentiated service request to the target service system for service processing, and obtain the differentiated response result of the target service system; A response conversion module, used to convert the differentiated response result into a standard response result and return it; The service request also includes a service system identifier. A mapping table maintenance module, used for obtaining a registered request adapter from the container in response to a container startup operation before the step of allocating a request adapter to the service request according to the service identifier, and establishing a request adapter mapping table with an index constructed by the request adapter as a key name and the request adapter identifier as a key value, wherein the index includes a service identifier and a service system identifier; Furthermore, the request conversion module is further used to allocate a request adapter to the service request according to the service identifier, the service system identifier and the request adapter mapping table.

8. An electronic device for processing a service request, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 4 to 6.

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

Citation Information

Patent Citations

  • Data interaction method and device, computer apparatus and storage medium

    CN109344183A