Data processing method and device, equipment, medium and program product
By using the return message table in the data processing method to query the service request processing results and terminate the duplicate processing, and calling the annotation processing request when necessary, the duplicate data processing problem caused by network exceptions or hardware failures is solved, and the unique processing of service requests and the stability of the system are realized.
Patent Information
- Application Number
- CN202411893708.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-12-20
AI Technical Summary
In the event of network communication abnormality or the underlying hardware facility failure, if the requesting party initiates a service call again on the same transaction, it will execute directly without verifying the idempotence, resulting in repeated processing of the data, resulting in transaction exceptions.
A data processing method is provided, by obtaining the target request identification and the microservice identification in response to the received target service request, and calling the pre-built return message table query processing result. If the result exists, the processing is terminated to avoid repeated processing; if the result does not exist and the processing status is unprocessed, the annotation corresponding to the microservice identity is called to complete the processing.
Ensure that each business request is processed only once, ensure the robustness and consistency of the system, avoid duplicate processing, and improve business processing efficiency.
Smart Images

Figure CN119583651A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of information technology or financial technology, and more specifically to a data processing method, device, equipment, medium and program product. Background Art
[0002] When there are system anomalies such as network communication anomalies and underlying hardware failures, if the requester initiates a service call for the same transaction again and executes it directly without checking idempotence, the data will be processed repeatedly, resulting in transaction anomalies. For account processing business, repeated service calls may cause transfer requests to be processed repeatedly, causing account anomalies. Summary of the invention
[0003] In view of the above problems, the present disclosure provides a data processing method, apparatus, device, medium and program product.
[0004] According to a first aspect of the present disclosure, a data processing method is provided, comprising: in response to receiving a target business request sent by a terminal, obtaining a target request identifier of the target business request from the target business request, and obtaining a target microservice identifier corresponding to the microservice that processes the target business request; calling a pre-constructed return message table, and querying the target business request processing result corresponding to the target request identifier from the return message table, wherein the return message table stores a correspondence between multiple groups of request identifiers and multiple groups of business request processing results; if the target business request processing result can be queried in the return message table, terminating the processing of the target business request to avoid repeated processing of the target business request; determining the processing status of the target business request; if the target business request processing result cannot be queried in the return message table and the processing status is unprocessed, calling the annotation corresponding to the microservice identifier to complete the processing of the business request.
[0005] According to an embodiment of the present disclosure, the above-mentioned determination of the processing status of the above-mentioned target business request also includes: calling a pre-constructed microservice idempotence data table, the above-mentioned microservice idempotence data table stores the correspondence between multiple groups of microservice identifiers and multiple groups of business registration tables, and the above-mentioned business registration table stores the correspondence between the request identifier and the business request processing status; querying the target business registration table corresponding to the above-mentioned microservice identifier from the above-mentioned microservice idempotence relationship table; querying the processing status of the target business request corresponding to the above-mentioned target request identifier from the above-mentioned target business registration table.
[0006] According to an embodiment of the present disclosure, the above-mentioned calling of the annotation corresponding to the above-mentioned microservice identifier to complete the processing of the above-mentioned business request includes: obtaining the object instance corresponding to the above-mentioned annotation and the parameters to be processed in the above-mentioned business request; inputting the above-mentioned parameters to be processed into the above-mentioned object instance to obtain the business request processing result, and the above-mentioned object instance includes a code for implementing the business processing logic.
[0007] According to an embodiment of the present disclosure, before inputting the to-be-processed parameters into the object instance to obtain the service request processing result, the process further includes: registering the service request processing status as being processed in the target service registration table.
[0008] According to an embodiment of the present disclosure, after inputting the to-be-processed parameters into the object instance to obtain the service request processing result, the method further includes: updating the target service request processing status in the target service registration table based on the service processing result.
[0009] According to an embodiment of the present disclosure, the above-mentioned updating of the target business request processing status in the above-mentioned target business registration table based on the above-mentioned business processing result includes: when the above-mentioned business request processing result indicates that the business request processing is successful, updating the above-mentioned target business request processing status to success; when the above-mentioned business request processing result indicates that the business request processing fails, updating the above-mentioned target business request processing status to failure.
[0010] According to an embodiment of the present disclosure, after terminating the processing of the above-mentioned business request, it also includes: assembling a return message based on the above-mentioned target request identifier, wherein the above-mentioned return message stores information used to characterize the failure of the above-mentioned business request processing; and sending the above-mentioned return message to the above-mentioned terminal.
[0011] A second aspect of the present disclosure provides a data processing device, including: an acquisition module, used to obtain a target request identifier of the target business request from the target business request in response to receiving a target business request sent by a terminal, and obtain a target microservice identifier corresponding to the microservice that processes the target business request; a query module, used to call a pre-constructed return message table, and query the target business request processing result corresponding to the target request identifier from the return message table, wherein the return message table stores a correspondence between multiple groups of request identifiers and multiple groups of business request processing results; a termination module, used to terminate the processing of the target business request when the target business request processing result can be queried in the return message table to avoid repeated processing of the target business request; a determination module, used to determine the processing status of the target business request; a processing module, used to call the annotation corresponding to the microservice identifier to complete the processing of the business request when the target business request processing result cannot be queried in the return message table and the processing status is unprocessed.
[0012] According to an embodiment of the present disclosure, the above-mentioned determination module includes: a microservice idempotent data table calling submodule, which is used to call a pre-built microservice idempotent data table, wherein the above-mentioned microservice idempotent data table stores a correspondence between multiple groups of microservice identifiers and multiple groups of business registration tables, and the above-mentioned business registration table stores a correspondence between a request identifier and a business request processing status; a target business registration table query submodule, which is used to query the target business registration table corresponding to the above-mentioned microservice identifier from the above-mentioned microservice idempotent relationship table; and a processing status query submodule, which is used to query the processing status of the target business request corresponding to the above-mentioned target request identifier from the above-mentioned target business registration table.
[0013] According to an embodiment of the present disclosure, the above-mentioned processing module includes: a sub-module for obtaining parameters to be processed, which is used to obtain the object instance corresponding to the above-mentioned annotation and the parameters to be processed in the above-mentioned business request; a business request processing sub-module, which is used to input the above-mentioned parameters to be processed into the above-mentioned object instance to obtain the business request processing result, and the above-mentioned object instance includes a code for implementing the business processing logic.
[0014] According to an embodiment of the present disclosure, the processing module further includes: a registration submodule, configured to register the processing status of the service request as being in process in the target service registration table.
[0015] According to an embodiment of the present disclosure, the processing module further includes: an updating submodule, configured to update the processing status of the target service request in the target service registration table based on the service processing result.
[0016] According to an embodiment of the present disclosure, the above-mentioned update sub-module includes: a processing success unit, which is used to update the above-mentioned target business request processing status to success when the above-mentioned business request processing result indicates that the business request processing is successful; and a processing failure unit, which is used to update the above-mentioned target business request processing status to failure when the above-mentioned business request processing result indicates that the business request processing fails.
[0017] According to an embodiment of the present disclosure, the above-mentioned device also includes: an assembling module, used to assemble a return message based on the above-mentioned target request identifier, wherein the above-mentioned return message stores information used to characterize the failure of the above-mentioned business request processing; a return message sending module, used to send the above-mentioned return message to the above-mentioned terminal.
[0018] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0019] The fourth aspect of the present disclosure further provides a computer-readable storage medium having a computer program or instructions stored thereon, which implements the steps of the above method when the above computer program or instructions are executed by a processor.
[0020] The fifth aspect of the present disclosure further provides a computer program product, including a computer program or instructions, which implement the steps of the above method when the above computer program or instructions are executed by a processor.
[0021] According to the embodiments of the present disclosure, the return message table is used to check whether the business processing request corresponding to the target request identifier is completed. When the target business request processing result exists in the return message table, the processing of the business request is terminated. When the target business request processing result does not exist in the return message table, the annotation is called to process the business request, thereby ensuring that each business request is processed only once, thereby ensuring the robustness and consistency of the system. Furthermore, by processing business requests through annotations, idempotent data processing and business data processing can be separated, decoupling the business logic and idempotent processing logic in the code, and reducing configuration complexity. By pre-constructing a return message table that stores the correspondence between the request identifier and the business request processing result, repeated processing can be avoided and business processing efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The above contents and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0023] Figure 1 The following schematically shows an application scenario diagram of a data processing method and device according to an embodiment of the present disclosure;
[0024] Figure 2 A flowchart schematically shows a data processing method according to an embodiment of the present disclosure;
[0025] Figure 3 A schematic diagram after introducing an idempotent processing component according to an embodiment of the present disclosure is schematically shown;
[0026] Figure 4 Schematically shows a flow chart of two idempotent switches according to an embodiment of the present disclosure; and
[0027] Figure 5 The structure block diagram of the data processing device according to the embodiment of the present disclosure is schematically shown;
[0028] Figure 6 A block diagram of an electronic device suitable for implementing a data processing method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0029] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0030] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0031] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0032] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0033] It should be noted that the data processing methods, devices, equipment, media and program products disclosed in the present invention can be used in the field of financial technology, and can also be used in any field other than the field of financial technology. The present disclosure does not limit the application fields of the data processing methods, devices, equipment, media and program products.
[0034] In the technical solution of the present disclosure, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0035] In the scenario of using personal information for automated decision-making, the methods, devices, and systems provided by the embodiments of the present disclosure provide users with corresponding operation portals for users to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered. The expression "automated decision-making" here refers to the activity of automatically analyzing and evaluating a person's behavioral habits, interests and hobbies, or economic, health, credit status, etc. through computer programs, and making decisions. The expression "expert decision-making" here refers to the activity of making decisions by people who specialize in a certain field, have specialized experience, knowledge and skills, and have reached a certain level of professionalism.
[0036] Service idempotence means that even if a service or operation is executed multiple times in the system, the result is the same as if it was executed once. However, in a distributed environment, the network environment is more complex. Due to network failures, repeated requests, slow response speeds, etc., the probability of repeated calls to services is greater than in a centralized environment. When there are system anomalies such as network communication anomalies and low-level hardware failures, if the requester initiates a service call for the same transaction again, the data will be processed repeatedly if the idempotence is not checked and the operation is executed directly, resulting in transaction anomalies. For account processing business, repeated service calls may cause transfer requests to be processed repeatedly, causing account anomalies.
[0037] An embodiment of the present disclosure provides a data processing method, comprising: in response to receiving a target business request sent by a terminal, obtaining a target request identifier of the target business request from the target business request, and obtaining a target microservice identifier corresponding to the microservice that processes the target business request; calling a pre-constructed return message table, and querying the return message table for a target business request processing result corresponding to the target request identifier, wherein the return message table stores a correspondence between multiple groups of request identifiers and multiple groups of business request processing results; if the target business request processing result can be queried in the return message table, terminating the processing of the target business request to avoid repeated processing of the target business request; determining the processing status of the target business request; if the target business request processing result cannot be queried in the return message table and the processing status is unprocessed, calling the annotation corresponding to the microservice identifier to complete the processing of the business request.
[0038] Figure 1 The application scenario diagram of the data processing method and device according to the embodiments of the present disclosure is schematically shown.
[0039] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a first server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0040] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0041] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0042] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0043] It should be noted that the data processing method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the data processing device provided in the embodiment of the present disclosure can generally be set in the server 105. The data processing method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the data processing device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.
[0044] It should be understood that Figure 1 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.
[0045] The following will be based on Figure 1 The scene described by Figure 2~Figure 4 The data processing method of the disclosed embodiment is described in detail.
[0046] Figure 2 The flowchart of the data processing method according to the embodiment of the present disclosure is schematically shown.
[0047] like Figure 2 As shown, the data processing method of this embodiment includes operations S210 to S250.
[0048] In operation S210, in response to receiving a target service request sent by a terminal, a target request identifier of the target service request is obtained from the target service request, and a target microservice identifier corresponding to a microservice that processes the target service request is obtained.
[0049] According to an embodiment of the present disclosure, the target request identifier is unique identification information that can identify the request, for example, it may be a unique event number.
[0050] In operation S220, a pre-constructed return message table is called, and a target service request processing result corresponding to the target request identifier is queried from the return message table.
[0051] The return message table stores the correspondence between multiple groups of request identifiers and multiple groups of service request processing results.
[0052] Table 1 schematically shows a return message table according to an embodiment of the present disclosure.
[0053] Table 1
[0054]
[0055] As shown in Table 1, the return message table may include the target request identifier of the microservice response, the return message, the transaction date, the time related to the transaction and other information, wherein the return message is the processing result of the above-mentioned business request.
[0056] In operation S230, when the processing result of the target service request can be obtained by searching the returned message table, the processing of the target service request is terminated to avoid repeated processing of the target service request.
[0057] In operation S240 , a processing status of the target service request is determined.
[0058] In operation S250, if the target business request processing result cannot be queried in the return message table and the processing status is unprocessed, the annotation corresponding to the microservice identifier is called to complete the processing of the business request.
[0059] According to the embodiments of the present disclosure, the return message table is used to check whether the business processing request corresponding to the target request identifier is completed. When the target business request processing result exists in the return message table, the processing of the business request is terminated. When the target business request processing result does not exist in the return message table, the annotation is called to process the business request, thereby ensuring that each business request is processed only once, thereby ensuring the robustness and consistency of the system. Furthermore, by processing business requests through annotations, idempotent data processing and business data processing can be separated, decoupling the business logic and idempotent processing logic in the code, and reducing configuration complexity. By pre-constructing a return message table that stores the correspondence between the request identifier and the business request processing result, repeated processing can be avoided and business processing efficiency can be improved.
[0060] According to an embodiment of the present disclosure, the above-mentioned determination of the processing status of the target business request also includes: calling a pre-built microservice idempotence data table, the microservice idempotence data table stores the correspondence between multiple groups of microservice identifiers and multiple groups of business registration tables, and the business registration table stores the correspondence between the request identifier and the business request processing status; querying the target business registration table corresponding to the microservice identifier from the microservice idempotence relationship table; and querying the processing status of the target business request corresponding to the target request identifier from the target business registration table.
[0061] According to an embodiment of the present disclosure, the microservice idempotent data table includes a correspondence between a microservice identifier and a business registration table, and each request can find a unique corresponding business registration record in the business registration table.
[0062] Table 2 schematically shows a microservice idempotent data table according to an embodiment of the present disclosure.
[0063] Table 2
[0064]
[0065] As shown in Table 2, for a microservice with a microservice identifier of Service1, the corresponding target business registration table Table1 can be found in the microservice idempotent data table, and then the business request processing status corresponding to the request identifier is found in the target registration table Table1.
[0066] According to the embodiment of the present disclosure, the target business registration table corresponding to the microservice identifier is obtained by querying the microservice idempotent data table, and then the processing status of the target business request is determined through the target business registration table, thereby ensuring that the idempotence of the processing result can also be guaranteed for a target business request in processing, and the relationship between the microservice identifier and the business registration table is recorded in the form of a microservice idempotent data table, which is convenient for expansion.
[0067] According to an embodiment of the present disclosure, the above-mentioned calling of the annotation corresponding to the microservice identifier to complete the processing of the business request includes: obtaining the object instance corresponding to the annotation and the parameters to be processed in the business request; inputting the parameters to be processed into the object instance to obtain the business request processing result, and the object instance includes code for implementing the business processing logic.
[0068] According to the embodiments of the present disclosure, aspects, pointcuts, etc. can be defined in some software frameworks through specific annotations. Aspects are the core concept of AOP (Aspect-Oriented Programming), which includes modular identification of cross-cutting concerns, allowing developers to separate cross-cutting concerns from business logic, thereby improving the modularity of the code. Cross-cutting concerns refer to functions that affect multiple classes or modules, such as logging, security checks, etc. The annotations in the present disclosure are based on the specific implementation of aspects in the software architecture.
[0069] According to the embodiments of the present disclosure, an aspect class can be defined for business request processing and defined as a framework component, so that the corresponding notification can be woven into the execution process of the target method. In the notification logic, the object instance and the parameters to be processed corresponding to the current annotation are obtained to process the target business request, and the business request processing result is returned to the object that calls the annotation.
[0070] According to the embodiments of the present disclosure, by obtaining the object instance corresponding to the annotation and the parameters to be processed in the business request, and inputting them into the object instance to obtain the business request processing result, the business processing logic and idempotent processing can be separated, thereby improving the modularity and maintainability of the code. Furthermore, processing the business logic through annotations improves the readability of the code.
[0071] According to an embodiment of the present disclosure, before inputting the to-be-processed parameters into the object instance to obtain the service request processing result, the process further includes: registering the service request processing status as being processed in the target service registration table.
[0072] According to an embodiment of the present disclosure, after inputting the to-be-processed parameters into the object instance to obtain the service request processing result, the method further includes: updating the target service request processing status in the target service registration table based on the service processing result.
[0073] According to an embodiment of the present disclosure, by registering the business request processing status in the target business registration table before processing the target business request, and updating the target business request processing status after obtaining the business request processing result, the processing status of the target business request can be tracked in real time, thereby ensuring the idempotence of the target business request processing.
[0074] According to an embodiment of the present disclosure, the above-mentioned updating of the target business request processing status in the target business registration table based on the business processing result includes: when the business request processing result indicates that the business request processing is successful, updating the target business request processing status to success; when the business request processing result indicates that the business request processing fails, updating the target business request processing status to failure.
[0075] According to an embodiment of the present disclosure, the above-mentioned business request processing status may include "processing", "failure" and "success". When there is corresponding data of the target business request processing status in the target business registration table, the return message can be automatically constructed and returned to the terminal according to the service input parameter class name and the service output parameter class name in the microservice idempotent relationship table.
[0076] According to an embodiment of the present disclosure, after terminating the processing of the service request, the method further includes: assembling a return message based on a target request identifier, wherein the return message stores information for characterizing the failure of the service request processing; and sending the return message to the terminal.
[0077] According to the embodiment of the present disclosure, when it is determined that the target service request processing result exists in the return message table, a failure return message can be directly constructed to end the processing of the service request.
[0078] According to the embodiment of the present disclosure, the above method can be modularized into an idempotent processing component as follows: Figure 3The schematic diagram after introducing the idempotent processing component according to an embodiment of the present disclosure is schematically shown.
[0079] like Figure 3 As shown, the left side shows that the idempotent processing component constructed according to the embodiment of the present disclosure is not introduced. After receiving the business request, it is directly processed and the business processing result is returned, while the right side introduces the idempotent processing component. The request is first pre-processed by the idempotent processing component, that is, the operation before S250 in the embodiment of the present disclosure, and then the business request is forwarded to the object instance corresponding to the annotation for processing, and the business processing result is returned to the idempotent processing component for post-public processing, that is, the above-mentioned update of the target business request processing status in the target business registration table based on the business processing result can effectively separate the idempotent processing and business processing.
[0080] According to an embodiment of the present disclosure, the parameter configuration center can be used to control whether to enable idempotence detection when processing business requests. The present disclosure supports enabling idempotence detection in two dimensions: application level and microservice level. In the default initial settings, the switches at the application level and microservice level are closed by default, and the application level is a control switch with a higher priority.
[0081] Figure 4 The flowcharts of two idempotent switches according to the embodiments of the present disclosure are schematically shown.
[0082] like Figure 4 As shown, it should be stated first that microservices can be included in applications. For idempotency detection, there are two levels of control switches, namely application level and microservice level. After responding to a business request, first determine whether the application level switch is turned on, and then determine whether the microservice level switch corresponding to the application is turned on. If both are turned on, idempotency detection is performed, otherwise no idempotency detection is performed. It can also be turned on at the application level and partially turned on at the microservice level. In this case, idempotency detection is only turned on for some microservices. This disclosure does not limit this.
[0083] According to the embodiment of the present disclosure, before determining the application-level switch and the microservice switch, the corresponding switch status can also be obtained in the parameter configuration center.
[0084] According to the embodiment of the present disclosure, a two-level switch is used to comprehensively control whether to perform idempotency detection, so that it is possible to flexibly control whether idempotency detection is turned on at the microservice level, and achieve overall control of idempotency detection through an application-level switch.
[0085] Based on the above data processing method, the present disclosure also provides a data processing device. Figure 5 The device is described in detail.
[0086] Figure 5The structure block diagram of a data processing device according to an embodiment of the present disclosure is schematically shown.
[0087] like Figure 5 As shown, the data processing device 500 of this embodiment includes an acquisition module 510 , a query module 520 , a termination module 530 , a determination module 540 and a processing module 550 .
[0088] The acquisition module 510 is used to obtain the target request identifier of the target business request from the target business request in response to receiving the target business request sent by the terminal, and obtain the target microservice identifier corresponding to the microservice that processes the target business request. In one embodiment, the acquisition module 510 can be used to perform the operation S210 described above, which will not be repeated here.
[0089] The query module 520 is used to call the pre-built return message table, and query the target service request processing result corresponding to the target request identifier from the return message table, wherein the return message table stores the correspondence between multiple groups of request identifiers and multiple groups of service request processing results. In one embodiment, the query module 520 can be used to perform the operation S220 described above, which will not be repeated here.
[0090] The termination module 530 is used to terminate the processing of the target service request when the target service request processing result can be queried in the return message table to avoid the target service request being repeatedly processed. In one embodiment, the termination module 530 can be used to perform the operation S230 described above, which will not be repeated here.
[0091] The determination module 540 is used to determine the processing status of the target service request. In one embodiment, the determination module 540 can be used to perform the operation S240 described above, which will not be described in detail here.
[0092] The processing module 550 is used to call the annotation corresponding to the microservice identifier to complete the processing of the business request when the target business request processing result cannot be queried in the return message table and the processing status is unprocessed. In one embodiment, the processing module 550 can be used to perform the operation S250 described above, which will not be repeated here.
[0093] According to an embodiment of the present disclosure, the above-mentioned determination module includes: a microservice idempotent data table calling submodule, which is used to call a pre-built microservice idempotent data table, wherein the above-mentioned microservice idempotent data table stores a correspondence between multiple groups of microservice identifiers and multiple groups of business registration tables, and the above-mentioned business registration table stores a correspondence between a request identifier and a business request processing status; a target business registration table query submodule, which is used to query the target business registration table corresponding to the above-mentioned microservice identifier from the above-mentioned microservice idempotent relationship table; and a processing status query submodule, which is used to query the processing status of the target business request corresponding to the above-mentioned target request identifier from the above-mentioned target business registration table.
[0094] According to an embodiment of the present disclosure, the above-mentioned processing module includes: a sub-module for obtaining parameters to be processed, which is used to obtain the object instance corresponding to the above-mentioned annotation and the parameters to be processed in the above-mentioned business request; a business request processing sub-module, which is used to input the above-mentioned parameters to be processed into the above-mentioned object instance to obtain the business request processing result, and the above-mentioned object instance includes a code for implementing the business processing logic.
[0095] According to an embodiment of the present disclosure, the processing module further includes: a registration submodule, configured to register the processing status of the service request as being in process in the target service registration table.
[0096] According to an embodiment of the present disclosure, the processing module further includes: an updating submodule, configured to update the processing status of the target service request in the target service registration table based on the service processing result.
[0097] According to an embodiment of the present disclosure, the above-mentioned update sub-module includes: a processing success unit, which is used to update the above-mentioned target business request processing status to success when the above-mentioned business request processing result indicates that the business request processing is successful; and a processing failure unit, which is used to update the above-mentioned target business request processing status to failure when the above-mentioned business request processing result indicates that the business request processing fails.
[0098] According to an embodiment of the present disclosure, the above-mentioned device also includes: an assembling module, used to assemble a return message based on the above-mentioned target request identifier, wherein the above-mentioned return message stores information used to characterize the failure of the above-mentioned business request processing; a return message sending module, used to send the above-mentioned return message to the above-mentioned terminal.
[0099] According to an embodiment of the present disclosure, any multiple modules among the acquisition module 510, the query module 520, the termination module 530, the determination module 540 and the processing module 550 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the acquisition module 510, the query module 520, the termination module 530, the determination module 540 and the processing module 550 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in a suitable combination of any of them. Alternatively, at least one of the acquisition module 510, the query module 520, the termination module 530, the determination module 540 and the processing module 550 may be at least partially implemented as a computer program module, and when the computer program module is executed, the corresponding function may be performed.
[0100] Figure 6 A block diagram of an electronic device suitable for implementing a data processing method according to an embodiment of the present disclosure is schematically shown.
[0101] like Figure 6 As shown, the electronic device 600 according to an embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 to a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include an onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0102] In RAM 603, various programs and data required for the operation of electronic device 600 are stored. Processor 601, ROM 602 and RAM 603 are connected to each other via bus 604. Processor 601 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 602 and / or RAM 603. It should be noted that the program can also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0103] According to an embodiment of the present disclosure, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to the bus 604. The electronic device 600 may further include one or more of the following components connected to the input / output (I / O) interface 605: an input portion 606 including a keyboard, a mouse, etc.; an output portion 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 608 including a hard disk, etc.; and a communication portion 609 including a network interface card such as a LAN card, a modem, etc. The communication portion 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage portion 608 as needed.
[0104] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0105] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: 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), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 602 and / or RAM 603 described above and / or one or more memories other than ROM 602 and RAM 603.
[0106] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the data processing method provided by the embodiment of the present disclosure.
[0107] The above functions defined in the system / device of the embodiment of the present disclosure are performed when the computer program is executed by the processor 601. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0108] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 609, and / or installed from a removable medium 611. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0109] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, apparatus, module, unit, etc. described above can be implemented by a computer program module.
[0110] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0111] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. 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.
[0112] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations or combinations are not explicitly described in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0113] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A data processing method, characterized in that: The method comprises: In response to receiving a target service request sent by a terminal, obtaining a target request identifier of the target service request from the target service request, and obtaining a target microservice identifier corresponding to a microservice that processes the target service request; Calling a pre-constructed return message table, and querying the target service request processing result corresponding to the target request identifier from the return message table, wherein the return message table stores a correspondence between multiple groups of request identifiers and multiple groups of service request processing results; When the processing result of the target service request can be obtained by querying the return message table, terminating the processing of the target service request to avoid repeated processing of the target service request; Determining a processing status of the target service request; If the target business request processing result cannot be queried in the return message table and the processing status is unprocessed, the annotation corresponding to the microservice identifier is called to complete the processing of the business request.
2. The method according to claim 1, characterized in that The determining the processing status of the target service request further includes: Calling a pre-built microservice idempotent data table, wherein the microservice idempotent data table stores a correspondence between multiple sets of microservice identifiers and multiple sets of business registration tables, wherein the business registration table stores a correspondence between a request identifier and a business request processing status; Query the target business registration table corresponding to the microservice identifier from the microservice idempotent relationship table; The processing status of the target service request corresponding to the target request identifier is queried from the target service registration table.
3. The method according to claim 1, characterized in that The calling of the annotation corresponding to the microservice identifier to complete the processing of the business request includes: Obtaining the object instance corresponding to the annotation and the parameters to be processed in the business request; The parameters to be processed are input into the object instance to obtain a business request processing result, and the object instance includes a code for implementing business processing logic.
4. The method according to claim 3, wherein the method comprises: Before inputting the to-be-processed parameters into the object instance to obtain the business request processing result, the method further includes: The service request processing status is registered in the target service registration table as being in process.
5. The method according to claim 4, characterized in that After the parameters to be processed are input into the object instance to obtain the business request processing result, the method further includes: The target service request processing status in the target service registration table is updated based on the service processing result.
6. The method according to claim 5, characterized in that The updating of the target service request processing status in the target service registration table based on the service processing result includes: If the service request processing result indicates that the service request processing is successful, updating the target service request processing status to success; When the service request processing result indicates that the service request processing fails, the target service request processing status is updated to failure.
7. The method according to claim 1, characterized in that After terminating the processing of the service request, the method further includes: Assembling a return message based on the target request identifier, wherein the return message stores information for characterizing the failure of processing the service request; Sending the return message to the terminal.
8. A data processing device, characterized in that: The device comprises: An acquisition module, configured to, in response to receiving a target service request sent by a terminal, acquire a target request identifier of the target service request from the target service request, and acquire a target microservice identifier corresponding to a microservice that processes the target service request; A query module, used to call a pre-constructed return message table, and query the target service request processing result corresponding to the target request identifier from the return message table, wherein the return message table stores a correspondence between multiple groups of request identifiers and multiple groups of service request processing results; A termination module, configured to terminate the processing of the target service request when the processing result of the target service request can be queried in the return message table, so as to avoid repeated processing of the target service request; A determination module, used to determine the processing status of the target service request; The processing module is used to call the annotation corresponding to the microservice identifier to complete the processing of the business request when the target business request processing result cannot be queried in the return message table and the processing status is unprocessed.
9. An electronic device, comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Business processing method, network system and server
CN109194760A
Service processing method and device, electronic equipment and computer readable storage medium
CN113946425A
Business processing method and device, electronic equipment and computer readable storage medium
CN115098528A
Method and device for interface verification, electronic equipment and storage medium
CN115277857A
Service consistency method, device and system under micro-service architecture and medium
CN115470226A