Data processing method, device, electronic device and storage medium

The method improves microservice architectures by storing and retrieving business processing identifiers in a header file, reducing code coupling and redundancy, and enhancing data processing traceability.

CN113296981BActive Publication Date: 2024-12-13CCB FINTECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110572709.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-25
Publication Date
2024-12-13
Estimated Expiration
2041-05-25

AI Technical Summary

Technical Problem

Existing microservice architectures require writing program code in each node to store and determine business processing requests, leading to high code coupling and redundancy, and fail to efficiently trace abnormal responses without a header file.

Method used

A data processing method where microservice nodes store and retrieve business processing identifiers using a header file, allowing node association information to be recorded and response data to be processed without additional code deployment, enhancing traceability.

Benefits of technology

This method reduces code coupling and intrusiveness, enabling efficient and convenient processing of business requests while maintaining data traceability by recording node associations and processing responses effectively.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113296981B_ABST
    Figure CN113296981B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of automatic programming, and discloses a data processing method, device, electronic device and storage medium, the method comprising: when a microservice node receives a business processing request and obtains a business processing identifier predetermined to correspond to the business processing request, the business processing request is processed based on the microservice node; the node association information of the microservice node is stored in a header file until the last microservice node corresponding to the business processing request feeds back the pending response data corresponding to the business processing request; the pending response data is fed back to the target microservice node, and the response data is configured and processed based on the target microservice node to obtain the target response data fed back to the client. This solution solves the problem of high code coupling in setting program codes in each microservice node to record business processing requests, and improves the convenience and efficiency of recording business processing requests.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of automatic programming, and in particular to a data processing method, device, electronic device and storage medium. Background Art

[0002] In the microservice architecture, when the client initiates a business processing request, there are multiple microservice nodes to process the business request. The business processing request usually reaches the master microservice node first. The master microservice node can generate a business processing request number and place the business processing request number in the header file of the business processing request. When the business processing request is processed by other slave microservice nodes, the processing record and the slave microservice processing result can be uploaded to the message header, thereby determining the microservice nodes that process the business processing request. At the same time, when the business processing request is abnormal, the abnormal microservice node can be determined based on the message header.

[0003] However, when using the above method to determine each microservice node for business processing requests, it is necessary to write corresponding program code in each microservice node to store the microservice node and processing results in a header file based on the program code, which leads to problems of strong code invasiveness, high coupling and code redundancy.

[0004] Furthermore, if the header file is not generated, when abnormal response data corresponding to the business processing request is received, the abnormal service node cannot be determined, resulting in a technical problem of low data processing efficiency. Summary of the invention

[0005] The present invention provides a data processing method, device, electronic device and storage medium to achieve the technical effect of conveniently recording business processing requests.

[0006] In a first aspect, an embodiment of the present invention provides a data processing method, characterized in that it is applied in a distributed microservice, including:

[0007] When the microservice node receives a business processing request and obtains a business processing identifier that is predetermined to correspond to the business processing request, the microservice node processes the business processing request; wherein the business processing identifier is an identifier stored in a header file after processing request association information corresponding to the business processing request;

[0008] The node association information of the microservice node is stored in the header file until the last microservice node corresponding to the business processing request feeds back the to-be-processed response data corresponding to the business processing request;

[0009] The response data to be processed is fed back to the target microservice node, and the response data is configured and processed based on the target microservice node to obtain target response data fed back to the client; wherein the target microservice node is the master node of the distributed microservice.

[0010] In a second aspect, an embodiment of the present invention further provides a data processing device, characterized in that it is configured in a distributed microservice, including:

[0011] A business processing module, configured to process the business processing request based on the microservice node when the microservice node receives the business processing request and obtains a business processing identifier that is predetermined to correspond to the business processing request; wherein the business processing identifier is an identifier that is stored in a header file after processing the request association information corresponding to the business processing request;

[0012] a response data determination module, configured to store the node association information of the microservice node in the header file until the last microservice node corresponding to the business processing request feeds back the to-be-processed response data corresponding to the business processing request;

[0013] A response data feedback module is used to feed back the response data to be processed to a target microservice node, and perform configuration processing on the response data based on the target microservice node to obtain target response data fed back to the client; wherein the target microservice node is the master node of the distributed microservice.

[0014] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0015] one or more processors;

[0016] a storage device for storing one or more programs,

[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the data processing method as described in any one of the embodiments of the present invention.

[0018] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to execute a data processing method as described in any one of the embodiments of the present invention.

[0019] The technical solution of the embodiment of the present invention sets corresponding components in each service node, so that when a business processing request is received, the node association information of the microservice node is stored in the header file until the last microservice node corresponding to the business processing request feeds back the pending response data corresponding to the business processing request, and feeds back the pending response data to the target microservice node, and performs configuration processing on the pending response data based on the components in the target microservice node to obtain the target response data fed back to the client, which solves the technical problem that the prior art needs to write corresponding program code in each microservice node to obtain the business processing identifier and record the business processing identifier, resulting in high code coupling and strong intrusiveness, and realizes that the business processing request can be processed without deploying the corresponding program code in each service node, which solves the problems of high code coupling and strong intrusiveness, and realizes that not only the business processing request can be processed effectively and conveniently, but also each microservice node that processes the business processing request can be recorded, thereby improving the technical effect of data processing traceability. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the following briefly introduces the drawings required to describe the embodiments. Obviously, the drawings introduced are only drawings of a part of the embodiments to be described in the present invention, rather than all the drawings. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 A schematic diagram of a data processing method provided in Embodiment 1 of the present invention;

[0022] Figure 2 A schematic diagram of a data processing method provided in Embodiment 2 of the present invention;

[0023] Figure 3 A schematic diagram of a microservice call provided in Embodiment 2 of the present invention;

[0024] Figure 4 A schematic diagram of a data processing method provided in Embodiment 3 of the present invention;

[0025] Figure 5 A schematic diagram of the structure of a data processing device provided in Embodiment 4 of the present invention;

[0026] Figure 6 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention. DETAILED DESCRIPTION

[0027] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0028] Embodiment 1

[0029] Figure 1 This is a flow chart of a data processing method provided by Embodiment 1 of the present invention. This embodiment is applicable to the case where each microservice node that processes a business processing request is recorded. The method can be executed by a data processing device, which can be implemented in the form of software and / or hardware. The hardware can be an electronic device, which can be a terminal or a PC, etc.

[0030] like Figure 1 The method of this embodiment includes:

[0031] S110: When the microservice node receives a business processing request and obtains a business processing identifier that is predetermined to correspond to the business processing request, the microservice node processes the business processing request.

[0032] Among them, the business processing request can specifically refer to an access request initiated from a user client to a server on the Internet. Through the business processing request, the client can obtain the data it needs from the server, which may include all structured or unstructured data such as pictures, audio and video. This embodiment can be applied to distributed microservices, that is, the microservice architecture is an implementation method of a distributed system. The microservice structure is to split a large and comprehensive application into a group of small applications that can be independently developed, deployed, tested or run independently, and use lightweight, based on the business domain name or business function. The business processing request can be a request initiated by any client to obtain a certain data. Optionally, when it is detected that the user triggers an operation on the display interface, a business processing request can be generated and sent to the distributed microservice. The business processing identifier can be an identifier that matches the business processing request.

[0033] Specifically, when the client initiates a business processing request, the master microservice node in the distributed microservice can receive the business processing request, and at this time can obtain a predetermined business processing identifier corresponding to the business processing request. After obtaining the business processing identifier, the business processing request can be processed based on the microservice of the master microservice node. Of course, if other slave microservice nodes need to be called, other slave microservice nodes can also be called to process the business processing request. It should be noted that before the slave microservice node processes the business processing request, it is also necessary to obtain the business processing identifier to record that the slave microservice node has processed the business processing request.

[0034] It should be noted that the business processing identifier is an identifier stored in the header file after processing the request association information corresponding to the business processing request.

[0035] On the basis of the above technical solution, before the microservice node receives the business processing request and obtains the business processing identifier predetermined to correspond to the business processing request, it also includes: when the target microservice node receives the business processing request, based on a preset business processing request interception component, obtaining the business processing request; determining the request association information corresponding to the business processing request; obtaining the business processing identifier corresponding to the business processing request by processing the request association information, and storing the business processing identifier in a header file.

[0036] Among them, the request interception component can be a Filter component, and the Filter component specifically refers to the filter component of the servlet, which realizes the filtering function by intercepting the request and response data so as to view, extract or operate the data exchanged between the client and the server in some way. Servlet is a Web component based on Java technology, running on the server side, which is managed by the servlet container and used to generate dynamic content. Based on the request interception component, the business processing request can be intercepted. After intercepting the business processing request, the request association information of the business processing request can be extracted. The request association information can be at least one of the url (resource locator), the access time of the business processing request, the transaction request parameters and the request access address. The request association information can be processed to obtain the business processing identifier of the business processing request, and the business processing identifier can be stored in the header file.

[0037] It should be noted that each business processing request has a corresponding header file.

[0038] In this embodiment, determining the request association information corresponding to the business processing request includes: recording the request association information in the business processing request based on the association information recording subcomponent in the interception component.

[0039] The request interception component, namely the interception component, also includes a correlation information recording subcomponent. The correlation information recording subcomponent can extract request correlation information and record the request correlation information.

[0040] On the basis of the above-mentioned technical solutions, the request-associated information is processed to obtain a business processing identifier corresponding to the business processing request, including: based on the snowflake algorithm encapsulated in the identifier generation component, the request-associated information is processed to obtain a character string sequence corresponding to the request-associated information, and the character string sequence is used as the business processing identifier of the request-associated information.

[0041] It should be noted that before the microservice node processes the business processing request, it is also necessary to obtain the business processing identifier corresponding to the business processing request, that is, it is necessary to predetermine the business processing identifier corresponding to the business processing request.

[0042] The identifier generation component is used to process the associated information of the business processing request and determine the business processing identifier of the business processing request. The snowflake algorithm is a method encapsulated in the identifier generation component and is used to process the request associated information. The string sequence is a string generated after the request associated information is processed by the snowflake algorithm. The generated string sequence can be used as the business processing identifier of the request associated information. The identifier generation component can be a Sleuth component, which is one of the components of the SpringCloud microservice architecture. Based on this component, a globally unique transaction request record number can be generated.

[0043] It should be noted that other algorithms may also be encapsulated in the identifier generation component, such as a hash algorithm, and the request-related information may be processed based on the hash algorithm to obtain a string sequence corresponding to the request-related information.

[0044] It should also be noted that when the algorithm encapsulated in the identifier generation component is used to process the request association information, the obtained string sequence is unique, that is, as long as the content of the request association information is different, the obtained string sequence is also different.

[0045] In this embodiment, the request association information includes the resource location corresponding to the business processing request, that is, the URL address, the request initiation timestamp of the business processing request, the access address corresponding to the business processing request, and the initialization sequence corresponding to when the business processing request is initiated.

[0046] The initialization sequence corresponding to each business processing request is different, and accordingly, the string sequence generated by the identifier generation component is also different.

[0047] Exemplarily, the business processing request is a transaction request. Before the transaction request reaches the microservice, the transaction request can be intercepted based on the filter component customized in the microservice, and based on the request association information of the transaction request, such as the transaction request URL path, the transaction start time, the transaction access IP address, and the transaction request parameters, the request association information is processed based on the Sleuth component in the microservice to obtain a globally unique request record number, that is, the business processing identifier.

[0048] After the service processing identifier is obtained, the service processing identifier can be stored in a header file for easy calling. Optionally, based on the identifier generation component, the generated service processing identifier is stored in a header file matching the service processing request.

[0049] The identifier generation component can not only process the business processing request to generate a business processing identifier, but also record the business processing identifier.

[0050] Specifically, after generating the business processing identifier, the identifier generation component can store the business processing identifier in a header file that matches the business processing request, so that when each microservice makes a business processing request, it can read the business processing identifier from the header file and store it in the microservice log of the corresponding microservice node.

[0051] S120: Store the node association information of the microservice node in the header file until the last microservice node corresponding to the business processing request feeds back the to-be-processed response data corresponding to the business processing request.

[0052] Each business processing request has a header file. The header file may store the service nodes of each microservice that processes the business processing request. For example, to store which microservices process the business processing request, the node identifier of the microservice may be stored in the header file. The node association information may include the microservice node identifier of the microservice, or the server identifier in the microservice node. The data obtained after each microservice processes the business processing request may be used as response data to be processed.

[0053] In actual application, a business processing request may be processed based on one microservice or multiple microservices. In order to facilitate tracing which microservice processed the business processing request, the node association information of the microservice may be stored in the header file, so as to realize microservice tracing when the business processing request is abnormal.

[0054] Specifically, if only one microservice, that is, the main node of the microservice, is needed to execute the business processing request, the business processing identifier can be directly obtained from the header file, and the business processing identifier can be stored in the node log of the microservice. At the same time, the node association information of the main microservice node can be stored in the header file. If multiple microservices are required to process the business processing request, the business processing request will usually be processed by the main microservice node in the distributed microservice first, and then processed by the corresponding slave microservices. Regardless of whether the main microservice or the slave microservice processes the business processing request, the node association information of each microservice that processes the business processing request needs to be stored in the header file. When each microservice processes the business processing request, it can retrieve or generate response data corresponding to the business processing request, that is, response data to be processed.

[0055] S130: Feedback the response data to be processed to the target microservice node, and perform configuration processing on the response data based on the target microservice node to obtain target response data fed back to the client.

[0056] The target microservice node is the master node of the distributed microservice. The configuration processing may be processing the response data to be processed into response data in a preset format. Accordingly, the response data processed into a preset format may be used as the target response data. At this time, the client is the client corresponding to the initiating business processing request.

[0057] Specifically, after each microservice has completed processing the business processing request, the response data to be processed can be fed back to the target microservice node. The data processing component in the target microservice node can format the response data to obtain the target response data in the target format. At the same time, the target response data can be fed back to the target client, that is, the target response data that is compatible with the business processing request is displayed on the target client.

[0058] The technical solution of the embodiment of the present invention sets corresponding components in each service node, so that when a business processing request is received, the node association information of the microservice node is stored in the header file until the last microservice node corresponding to the business processing request feeds back the pending response data corresponding to the business processing request, and feeds back the pending response data to the target microservice node, and performs configuration processing on the pending response data based on the components in the target microservice node to obtain the target response data fed back to the client, which solves the technical problem that the prior art needs to write corresponding program code in each microservice node to obtain the business processing identifier and record the business processing identifier, resulting in high code coupling and strong intrusiveness, and realizes that the business processing request can be processed without deploying the corresponding program code in each service node, which solves the problems of high code coupling and strong intrusiveness, and realizes that not only the business processing request can be processed effectively and conveniently, but also each microservice node that processes the business processing request can be recorded, thereby improving the technical effect of data processing traceability.

[0059] On the basis of the above technical solutions, each microservice node includes an identifier generation component and an identifier acquisition component; or, the target microservice node includes an identifier generation component and an identifier acquisition component, and the slave microservice node includes an identifier acquisition component.

[0060] It should be noted that an identification generation component and an identification acquisition component can be set in each service node, so that when each microservice receives a business processing request, it can first obtain whether the business processing identifier is included in the header file based on the identification acquisition component. If so, the identification generation component may not generate a business processing identifier at this time. On the contrary, the business processing identifier is generated based on the identification generation component. Of course, it can also be that since each microservice is a distributed microservice, all business processing requests can be forwarded to the main microservice of the distributed microservice first. At this time, the identification generation component and the identification acquisition component can be set in the main microservice, and the identification acquisition component can be set in the slave microservice node. The advantage of this setting is that the main microservice node can generate a business processing identifier first, and the slave microservice node can directly obtain the generated business processing identifier from the header file, avoiding the problem of setting two components in all microservices and the problem of resource redundancy.

[0061] Embodiment 2

[0062] Figure 2A flow chart of a data processing method provided in the second embodiment of the present invention. Based on the above embodiment, "storing the node association information of the microservice node in the header file until the last microservice node corresponding to the business processing request feeds back the pending response data corresponding to the business processing request" can be specifically optimized, and the specific method of optimization can be found in the technical solution of this embodiment. Among them, the technical terms that are the same as or corresponding to the above embodiment are not repeated here.

[0063] like Figure 2 As shown, the method includes:

[0064] S210: When the microservice node receives a business processing request and obtains a business processing identifier predetermined to correspond to the business processing request, the microservice node processes the business processing request.

[0065] Optionally, the master microservice node calls the slave microservice node to process the business processing request, obtains the business processing identifier from the header file based on an identifier acquisition component in the slave microservice node, and stores the business processing identifier in a log corresponding to the slave microservice node.

[0066] It should be noted that the microservice that processes the business processing request may be one or more. If the business processing request needs to be processed from a microservice node, this embodiment may be used to execute it.

[0067] The identification acquisition component is a component that obtains the pre-generated business processing identification from the header file. Each microservice can include multiple servers, and each server has a corresponding log, which can record the operation information of the corresponding microservice, such as power on / off information, business processing identification of business processing request processing, etc.

[0068] Specifically, when the master microservice calls the slave microservice, that is, when the master microservice node calls the slave microservice node to process the business processing request, the business processing identifier stored in the header file can be obtained based on the identifier acquisition component set in the slave microservice node.

[0069] It should be noted that the identification acquisition component can first determine whether the business processing request identifier is included in the header file. If not, the business processing identifier can be generated based on the identification generation component in the slave microservice node. Normally, the identification generation component in the main microservice node can process the request-related information to obtain the business processing identifier. In the slave microservice node, usually only the identification acquisition component can be set to obtain the stored business processing identifier from the header file. After obtaining the business processing identifier, the business processing identifier can be stored in the log of the microservice, and it can also be determined based on the logs of each microservice which business processing requests have been processed by the microservice, thereby improving the technical effect of the efficiency of business processing request queries.

[0070] For example, Figure 3 This is a schematic diagram of a microservice call provided by Embodiment 2 of the present invention. Figure 3 As shown in the figure, within the microservice architecture, each microservice relies on the Sleuth component (a collection of identity acquisition components and identity generation components). When the service request first reaches the main microservice node A, the Sleuth Agent will check whether the request message header contains TraceContext (business processing identity). If not, a business processing identity will be created (the business processing request can be processed based on the snowflake algorithm encapsulated in the identity generation component to obtain the business processing identity). At this time, the custom Filter component can also obtain the created business processing identity through the interface, and this business processing identity can be used as the transaction request record number. If the main microservice node A continues to initiate a service call to the slave microservice node B or the slave microservice node C, Sleuth will inject the newly generated TraceContext into the header file. When the business processing request reaches the slave microservice node B or the slave microservice node C, the slave service nodes B and C can obtain the business processing identity from the header file, thereby achieving the purpose of global uniqueness of the business processing identity.

[0071] This technical solution realizes that under the microservice architecture, a globally unique request record number (business processing identifier) ​​can be generated based on the Sleuth component, a custom Serlvet Filter is used to record transaction requests (business processing requests), and multiple transaction request record preservation solutions and implementation codes are implemented through configuration.

[0072] S220: Store the server identifier corresponding to each microservice node in the header file, and feed back the response data to be processed obtained by processing the last microservice node of the business processing request to the main microservice node.

[0073] It should be noted that while recording the business processing identifier in the log of the corresponding microservice, the identifier of the microservice can also be stored in the header file.

[0074] Among them, a microservice can be composed of multiple servers. In order to clearly determine which servers have processed the business processing request, the server identifier can be stored in the header file. The advantage of this setting is that only based on the information stored in the header file, it is possible to determine which servers in the microservices have processed the business processing request, so that when an exception is detected in the processing of the business processing request, the microservice that processed the exception and the corresponding server can be determined based on the content stored in the header file, thereby improving the technical effect of data query efficiency. After detecting that the last microservice has completed processing the business processing request, the pending response data generated by the microservice can be fed back to the main microservice node.

[0075] It should be noted that the response data to be processed is data corresponding to the business processing request, such as audio and video data.

[0076] S230: Perform configuration processing on the response data based on the target microservice node to obtain target response data that is fed back to the client.

[0077] The response data to be processed can be returned to the custom interceptor component set in the main microservice node. This component can perform configurable processing on the response data and obtain the target response data that is fed back to the client.

[0078] The technical solution of the embodiment of the present invention sets corresponding components in each service node, so that when a business processing request is received, the node association information of the microservice node is stored in the header file until the last microservice node corresponding to the business processing request feeds back the pending response data corresponding to the business processing request, and feeds back the pending response data to the target microservice node, and performs configuration processing on the pending response data based on the components in the target microservice node to obtain the target response data fed back to the client, which solves the technical problem that the prior art needs to write corresponding program code in each microservice node to obtain the business processing identifier and record the business processing identifier, resulting in high code coupling and strong intrusiveness, and realizes that the business processing request can be processed without deploying the corresponding program code in each service node, which solves the problems of high code coupling and strong intrusiveness, and realizes that not only the business processing request can be processed effectively and conveniently, but also each microservice node that processes the business processing request can be recorded, thereby improving the technical effect of data processing traceability.

[0079] Embodiment 3

[0080] Figure 4A flow chart of a data processing method provided in the third embodiment of the present invention. Based on the above embodiments, "configuration processing of the response data based on the target microservice node to obtain target response data fed back to the client" can be specifically optimized, and the specific method of optimization can be found in the technical solution of this embodiment. Among them, the technical terms that are the same as or corresponding to the above embodiments are not repeated here.

[0081] like Figure 4 As shown, the method includes:

[0082] S310: When a microservice node receives a business processing request and obtains a business processing identifier predetermined to correspond to the business processing request, the microservice node processes the business processing request.

[0083] S320: Store the server identifier corresponding to each microservice node in the header file, and feed back the response data to be processed obtained by processing the last microservice node of the business processing request to the main microservice node.

[0084] S330: Record the response data to be processed and data associated with the response data to be processed based on the response data recording component in the target microservice node.

[0085] The response data recording component may be an interceptor component set in the main microservice node. The interceptor component may record the last pending response data fed back from the microservice node, and may also record the associated data corresponding to the pending response data. The associated data may include the server address for processing the business processing request, the start time of the business processing request, the end time of the business processing request execution, the pending response data, and the exception information.

[0086] It should be noted that the response time for processing the business processing request can be determined based on the start time recorded in the filter component and the end time of the business processing request execution, and the response time can be used as the transaction time.

[0087] In this embodiment, the reason for recording the response data through the response data recording component is that when the business processing request is returned to the filter component, the response data is in an unreadable state and cannot be recorded in the transaction flow, so the response data to be processed can be fed back to the response data recording component to retrieve the response data to be processed from the response data recording component when the filter receives the feedback business processing request.

[0088] S340, storing the response data to be processed and the associated data corresponding to the response data to be processed in the target storage location, so as to retrieve the response data to be processed and the associated data from the target storage location when it is detected that the business processing request is fed back to the target microservice node, and generate the target response data according to the response data to be processed and the associated data.

[0089] The target storage location may be a location where the corresponding data recording component stores the data after recording the data. In this embodiment, the target storage location may be a thread variable in the memory.

[0090] Specifically, based on the response data recording component, the response data to be processed and the related data are recorded in the target storage location, and when it is detected that the business processing request is fed back to the target microservice node, the response data to be processed and the related data are retrieved from the target storage location, and then the target response data is generated based on the retrieved data.

[0091] Optionally, storing the pending response data and the associated data corresponding to the pending response data to the target storage location includes: storing the pending response data and the associated data corresponding to the pending response data in a memory thread variable, so as to extract the pending response data and the associated information from the memory thread variable when receiving a feedback business processing request.

[0092] The memory thread variable is a storage space for temporarily storing response data and associated data to be processed.

[0093] Specifically, when the main microservice node receives the feedback business processing request, it can retrieve the pending response data and associated data adapted to the business processing request from the memory thread variable according to the business processing request. By processing the pending response data and associated data, the target response data is obtained.

[0094] Optionally, when receiving a feedback business processing request, the pending response data and the associated information are extracted from the memory thread variable, including: when receiving a feedback business processing request, extracting the pending response data and the associated information from the memory thread variable and processing them into a business flow record object according to a pre-configured configuration file; and feeding back the business flow record object to the target client.

[0095] The configuration file is pre-set and used to process the response data to be processed into a file of a preset format. The response data to be processed processed by the configuration file can be used as the target response data, or it can be a business flow record object, and the business flow record object is fed back to the target client.

[0096] Exemplarily, when the business processing request reaches the filter component again, the pending response data and related data recorded by the response data recording component can be extracted from the memory thread variable first, and the pending response data and related data can be processed into target response data in a preset format and fed back to the target client.

[0097] The technical solution of the embodiment of the present invention sets corresponding components in each service node, so that when a business processing request is received, the node association information of the microservice node is stored in the header file until the last microservice node corresponding to the business processing request feeds back the pending response data corresponding to the business processing request, and feeds back the pending response data to the target microservice node, and performs configuration processing on the pending response data based on the components in the target microservice node to obtain the target response data fed back to the client, which solves the technical problem that the prior art needs to write corresponding program code in each microservice node to obtain the business processing identifier and record the business processing identifier, resulting in high code coupling and strong intrusiveness, and realizes that the business processing request can be processed without deploying the corresponding program code in each service node, which solves the problems of high code coupling and strong intrusiveness, and realizes that not only the business processing request can be processed effectively and conveniently, but also each microservice node that processes the business processing request can be recorded, thereby improving the technical effect of data processing traceability.

[0098] It should also be noted that the method of recording transaction requests (business processing requests) provided in this embodiment does not affect the existing business logic and is non-invasive to the code. At the same time, a variety of storage methods for transaction request records can be implemented through flexible configuration strategies.

[0099] Embodiment 4

[0100] Figure 5 This is a structural schematic diagram of a data processing device provided in Embodiment 4 of the present invention. The device is configured in a distributed microservice, and includes: a business processing module 410, a response data determination module 420 and a response data feedback module 430.

[0101] The business processing module 410 is used to process the business processing request based on the microservice node when the microservice node receives the business processing request and obtains the business processing identifier predetermined to correspond to the business processing request; wherein the business processing identifier is an identifier stored in the header file after processing the request association information corresponding to the business processing request; the response data determination module 420 is used to store the node association information of the microservice node in the header file until the last microservice node corresponding to the business processing request feeds back the pending response data corresponding to the business processing request; the response data feedback module 430 is used to feed back the pending response data to the target microservice node, and perform configuration processing on the response data based on the target microservice node to obtain the target response data fed back to the client; wherein the target microservice node is the master node of the distributed microservice.

[0102] On the basis of the above technical solution, the device further includes: a data processing module, which is used for the microservice node to receive the business processing request and obtain the business processing identifier predetermined to correspond to the business processing request before the business processing module is used to:

[0103] A business processing request acquisition unit is used to obtain the business processing request based on a pre-set business processing request interception component when the target microservice node receives the business processing request; a request association information determination unit is used to determine the request association information corresponding to the business processing request; a business processing identifier storage unit is used to obtain a business processing identifier corresponding to the business processing request by processing the request association information, and store the business processing identifier in a header file.

[0104] On the basis of the above technical solution, the request association information determination unit is further used to: record the request association information in the business processing request based on the association information recording subcomponent in the interception component.

[0105] Based on the above-mentioned technical solutions, the business processing identifier determination unit is also used to: process the request associated information based on the snowflake algorithm encapsulated in the identifier generation component, obtain a character string sequence corresponding to the request associated information, and use the character string sequence as the business processing identifier of the request associated information.

[0106] Based on the above technical solutions, the request association information includes at least one of a resource locator corresponding to the business processing request, a request initiation timestamp of the business processing request, an access address corresponding to the business processing request, and an initialization sequence.

[0107] On the basis of the above technical solutions, the business processing identifier storage unit is further used to store the generated business processing identifier in a header file matching the business processing request based on the identifier generation component.

[0108] On the basis of the above technical solutions, the business processing module also includes: a business processing identification acquisition unit, which is used to call the slave microservice node to process the business processing request at the master microservice node, and obtain the business processing identification from the header file based on the identification acquisition component in the slave microservice node; a business processing identification storage unit, which is used to store the business processing identification in a log corresponding to the slave microservice node.

[0109] Based on the above technical solutions, the corresponding data determination module is also used to: store the server identifier corresponding to each microservice node in the header file, and feed back the pending response data obtained by processing the last microservice node of the business processing request to the main microservice node.

[0110] On the basis of the above technical solutions, the response data feedback module includes:

[0111] A data recording unit, configured to record the response data to be processed and associated data with the response data to be processed based on the response data recording component in the target microservice node, wherein the associated data includes: a server address for processing the business processing request, a start time of the business processing request, an end time of the business processing request execution, the response data to be processed, and exception information;

[0112] A data response unit is used to store the response data to be processed and the associated data corresponding to the response data to be processed to a target storage location, so as to generate target response data from the response data to be processed and the associated data in the target storage location when it is detected that the business processing request is fed back to the target microservice node, according to the response data to be processed and the associated data.

[0113] On the basis of the above-mentioned technical solutions, the data response unit is used to: store the response data to be processed and the associated data corresponding to the response data to be processed in a memory thread variable, so as to extract the response data to be processed and the associated information from the memory thread variable when receiving a feedback business processing request.

[0114] On the basis of the above technical solutions, the data response unit is used to: when receiving the feedback business processing request, extract the response data to be processed and the associated information from the memory thread variable according to the pre-configured configuration file and process them into a business flow record object;

[0115] Feedback the business flow record object to the target client.

[0116] On the basis of the above technical solutions, each microservice node includes an identifier generation component and an identifier acquisition component; or, the target microservice node includes an identifier generation component and an identifier acquisition component, and the slave microservice node includes an identifier generation component.

[0117] The technical solution of the embodiment of the present invention is to set corresponding components in each service node so that when receiving a business processing request, the node association information of the microservice node is stored in the header file until the last microservice node corresponding to the business processing request feeds back the pending response data corresponding to the business processing request, and feeds back the pending response data to the target microservice node, and configures the pending response data based on the components in the target microservice node to obtain the target response data fed back to the client, which solves the technical problem that the corresponding program code needs to be written in each microservice node to obtain the business processing identifier and record the business processing identifier in the prior art, resulting in high code coupling and strong intrusiveness, and realizes that the business processing request can be processed without deploying the corresponding program code in each service node, which solves the problem of high code coupling and strong intrusiveness, and realizes that not only the business processing request is effectively and conveniently processed, but also each microservice node that processes the business processing request can be recorded, thereby improving the technical effect of data processing traceability. The data processing device provided by the embodiment of the present invention can execute the data processing method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

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

[0119] Embodiment 5

[0120] Figure 6 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention. Figure 6 A block diagram of an exemplary electronic device 50 suitable for implementing exemplary embodiments of the present invention is shown. Figure 6 The electronic device 50 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.

[0121] like Figure 6As shown, the electronic device 50 is in the form of a general computing device. The components of the electronic device 50 may include but are not limited to: one or more processors or processing units 501, a system memory 502, and a bus 503 connecting different system components (including the system memory 502 and the processing unit 501).

[0122] Bus 503 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.

[0123] The electronic device 50 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 50, including volatile and non-volatile media, removable and non-removable media.

[0124] System memory 502 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 504 and / or cache memory 505. Electronic device 50 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 506 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 not shown, usually called a "hard drive"). Although Figure 6 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 503 via one or more data medium interfaces. The memory 502 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the embodiments of the present invention.

[0125] A program / utility 508 having a set (at least one) of program modules 507 may be stored, for example, in the memory 502, such program modules 507 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 507 generally perform the functions and / or methods of the embodiments described herein.

[0126] The electronic device 50 may also communicate with one or more external devices 509 (e.g., keyboards, pointing devices, displays 510, etc.), may communicate with one or more devices that enable a user to interact with the electronic device 50, and / or communicate with any device that enables the electronic device 50 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed through an input / output (I / O) interface 511. Furthermore, the electronic device 50 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 512. As shown, the network adapter 512 communicates with other modules of the electronic device 50 through the bus 503. It should be understood that although Figure 6 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 50, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0127] The processing unit 501 executes various functional applications and data processing by running the programs stored in the system memory 502, such as implementing the data processing method provided in the embodiment of the present invention.

[0128] Embodiment 6

[0129] Embodiment 6 of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions are used to execute a data processing method when executed by a computer processor.

[0130] The method includes:

[0131] When the microservice node receives a business processing request and obtains a business processing identifier that is predetermined to correspond to the business processing request, the microservice node processes the business processing request; wherein the business processing identifier is an identifier stored in a header file after processing request association information corresponding to the business processing request;

[0132] The node association information of the microservice node is stored in the header file until the last microservice node corresponding to the business processing request feeds back the to-be-processed response data corresponding to the business processing request;

[0133] The response data to be processed is fed back to the target microservice node, and the response data is configured and processed based on the target microservice node to obtain target response data fed back to the client; wherein the target microservice node is the master node of the distributed microservice.

[0134] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can 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 (non-exhaustive list) of computer-readable storage media include: 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 this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0135] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals 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 a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0136] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0137] Computer program code for performing the operation of embodiments of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

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

Claims

1. A data processing method, characterized in that: Applied to distributed microservices, including: When the microservice node receives a business processing request and obtains a business processing identifier that is predetermined to correspond to the business processing request, the microservice node processes the business processing request; wherein the business processing identifier is an identifier stored in a header file after processing request association information corresponding to the business processing request; The node association information of the microservice node is stored in the header file until the last microservice node corresponding to the business processing request feeds back the to-be-processed response data corresponding to the business processing request; Feeding back the response data to be processed to the target microservice node, and performing configuration processing on the response data to be processed based on the target microservice node to obtain target response data fed back to the client; wherein the target microservice node is the master node of the distributed microservice; Among them, the microservice node includes a target microservice node and a slave microservice node, and the target microservice node is provided with a business processing request interception component, a data processing component, an identifier generation component and an identifier acquisition component, and the slave microservice node includes an identifier generation component and an identifier acquisition component. The business processing request interception component is used to intercept the business processing request, and the identifier generation component is used to process the request association information and determine the business processing identifier of the business processing request. The data processing component is used to perform configuration processing on the response data to be processed to obtain the target response data, and the configuration processing includes formatting processing. The identifier acquisition component is used to obtain a pre-generated business processing identifier from a header file.

2. The method according to claim 1, characterized in that Before the microservice node receives the business processing request and obtains a business processing identifier predetermined to correspond to the business processing request, the method further includes: When the target microservice node receives a business processing request, the target microservice node obtains the business processing request based on a pre-set business processing request interception component; Determining request association information corresponding to the business processing request; By processing the request association information, a business processing identifier corresponding to the business processing request is obtained, and the business processing identifier is stored in a header file.

3. The method according to claim 2, characterized in that The determining the request association information corresponding to the business processing request includes: Based on the association information recording subcomponent in the business processing request interception component, the request association information in the business processing request is recorded.

4. The method according to claim 2, characterized in that: The obtaining of a service processing identifier corresponding to the service processing request by processing the request association information includes: Based on the snowflake algorithm encapsulated in the identifier generation component, the request-related information is processed to obtain a character string sequence corresponding to the request-related information, and the character string sequence is used as a business processing identifier of the request-related information.

5. The method according to any one of claims 1 to 4, characterized in that: The request association information includes at least one of a resource locator corresponding to the service processing request, a request initiation timestamp of the service processing request, an access address corresponding to the service processing request, and an initialization sequence.

6. The method according to claim 2, characterized in that The storing the service processing identifier into a header file includes: Based on the identifier generation component, the generated service processing identifier is stored in a header file matching the service processing request.

7. The method according to claim 1, characterized in that When the microservice node receives the business processing request and obtains a business processing identifier predetermined to correspond to the business processing request, the microservice node processes the business processing request, including: The master microservice node calls the slave microservice node to process the service processing request, and based on the identifier acquisition component in the slave microservice node, acquires the service processing identifier from the header file; The business processing identifier is stored in a log corresponding to the slave microservice node.

8. The method according to claim 1, characterized in that: The storing the node association information of the microservice node in the header file until the last microservice node corresponding to the business processing request feeds back the to-be-processed response data corresponding to the business processing request, comprises: The server identifier corresponding to each microservice node is stored in the header file, and the response data to be processed obtained by processing the last microservice node of the business processing request is fed back to the main microservice node.

9. The method according to claim 1, characterized in that: The configuring and processing the response data to be processed based on the target microservice node to obtain the target response data fed back to the client includes: Based on the response data recording component in the target microservice node, the response data to be processed and the associated data with the response data to be processed are recorded, wherein the associated data includes: the server address for processing the business processing request, the start time of the business processing request, the end time of the business processing request execution, the response data to be processed and the exception information; The response data to be processed and the associated data corresponding to the response data to be processed are stored in a target storage location, so that when it is detected that the business processing request is fed back to the target microservice node, the response data to be processed and the associated data are extracted from the target storage location, and the target response data is generated according to the response data to be processed and the associated data.

10. The method according to claim 9, characterized in that The storing the response data to be processed and the associated data corresponding to the response data to be processed to the target storage location includes: The response data to be processed and the associated data corresponding to the response data to be processed are stored in a memory thread variable, so that when a feedback business processing request is received, the response data to be processed and the associated data are extracted from the memory thread variable.

11. The method according to claim 10, characterized in that When receiving the feedback service processing request, extracting the response data to be processed and the associated data from the memory thread variable includes: When receiving the feedback business processing request, the response data to be processed and the associated data are extracted from the memory thread variable according to the pre-configured configuration file and processed into a business flow record object; Feedback the business flow record object to the target client.

12. The method according to claim 1, characterized in that The target microservice node includes an identification generation component and an identification acquisition component, and the slave microservice node includes an identification generation component.

13. A data processing device, characterized in that: Configured in distributed microservices, including: A business processing module, configured to process the business processing request based on the microservice node when the microservice node receives the business processing request and obtains a business processing identifier that is predetermined to correspond to the business processing request; wherein the business processing identifier is an identifier that is stored in a header file after processing the request association information corresponding to the business processing request; a response data determination module, configured to store the node association information of the microservice node in the header file until the last microservice node corresponding to the business processing request feeds back the to-be-processed response data corresponding to the business processing request; A response data feedback module, used to feed back the response data to be processed to a target microservice node, and perform configuration processing on the response data to be processed based on the target microservice node to obtain target response data fed back to the client; wherein the target microservice node is a master node of a distributed microservice; Among them, the microservice node includes a target microservice node and a slave microservice node, and the target microservice node is provided with a business processing request interception component, a data processing component, an identifier generation component and an identifier acquisition component, and the slave microservice node includes an identifier generation component and an identifier acquisition component. The business processing request interception component is used to intercept the business processing request, and the identifier generation component is used to process the request association information and determine the business processing identifier of the business processing request. The data processing component is used to perform configuration processing on the response data to be processed to obtain the target response data, and the configuration processing includes formatting processing. The identifier acquisition component is used to obtain a pre-generated business processing identifier from a header file.

14. An electronic device, characterized in that: The electronic device comprises: 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 data processing method according to any one of claims 1 to 12.

15. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to perform the data processing method according to any one of claims 1 to 12 when executed by a computer processor.