Microservice-oriented business request processing method, device, equipment and storage medium

By using Spring interface interceptor and Feign request interceptor to manage link identifiers in a microservice environment, the problems of microservice link tracking and asynchronous thread link disconnection are solved, and automated log printing and low-cost development are achieved.

CN113867913BActive Publication Date: 2024-10-01PINGAN INT SMART CITY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111135132.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-27
Publication Date
2024-10-01
Estimated Expiration
2041-09-27

AI Technical Summary

Technical Problem

In a microservice environment, it is difficult to track links. Existing methods increase development workload and may cause bugs, especially when asynchronous thread processing causes link disconnection.

Method used

Obtain or generate the link identifier through the Spring interface interceptor, store it in the main thread local variables and log storage, and use AOP annotations to implement automated log printing, update the link identifier based on the Feign request interceptor, and use the preset thread pool instance method to pass the link identifier to the asynchronous thread.

Benefits of technology

It realizes link tracking and automatic printing of logs, reduces development and maintenance costs, avoids code intrusion, and solves the problem of link disconnection in asynchronous threads.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113867913B_ABST
    Figure CN113867913B_ABST
Patent Text Reader

Abstract

The present application relates to the field of artificial intelligence, and provides a microservice-oriented business request processing method. A link identifier is obtained or generated from an interface request parameter through a Spring interface interceptor, and the link identifier is stored in a main thread local variable and a main thread log storage. Because the link identifier is added in the main thread log storage, the link can be tracked; AOP annotations are used to realize automatic log printing, which reduces development costs and maintenance costs, and greatly reduces code intrusion; based on a Feign request interceptor, the target link identifier in the main thread local variable is updated to the Feign request header, thereby solving the link series connection problem of Feign calls; based on the main thread local variable and the main thread log storage, a preset thread pool instantiation method and a method of overriding an Executor object are used to realize the transfer of the link identifier to an asynchronous thread, and both the Spring interceptor and the Feign request interceptor avoid code intrusion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of artificial intelligence technology, and in particular, relates to a microservice-oriented business request processing method, device, equipment and storage medium. Background Art

[0002] In a microservice environment, multiple components together form an interface service, and each interface service may call multiple different components. It is impossible to pass all call parameters to the called component every time during the call process. This makes it difficult to distinguish which logs of the caller and the callee are from the same interface call when troubleshooting through logs. To solve this problem, a unique identifier (hereinafter referred to as traceId) needs to be generated on the caller each time and passed to the called component to mark which logs are from the same interface call.

[0003] Although this method achieved the original goal, it undoubtedly increased a lot of workload, so a solution appeared on the market: because each request must first pass through the gateway component, a traceId can be generated in the gateway component, and then this traceId is placed in the header of the interface request and passed down each time, which basically solves the problem.

[0004] However, this method still has shortcomings: code invasion increases the development workload (at least the gateway code and the public package code introduced by each component need to be modified); when processing asynchronous threads, the link will be disconnected, resulting in the inability to track the link. When printing interface request information, special processing is also required each time, which increases a lot of development workload and may also cause bugs. Summary of the invention

[0005] In view of the above, the present invention provides a microservice-oriented business request processing method, device, equipment and storage medium, which aims to solve the technical problem that link tracking cannot be performed in the prior art.

[0006] To achieve the above object, the present invention provides a microservice-oriented business request processing method, the method comprising:

[0007] Obtain the business interface call request sent by the target client, obtain the request header from the business interface call request based on the Spring interface interceptor, parse the obtained request header and determine whether there is a link identifier, and when the link identifier exists, use the parsed link identifier as the target link identifier, otherwise regenerate a link identifier as the target link identifier;

[0008] In the Spring interface interceptor, the target link identifier is assigned to the main thread local variable and the main thread log storage respectively;

[0009] Based on the AOP annotation and the main thread log storage, the interface information of the business interface corresponding to the business interface call request is printed to obtain a call request parameter log and a request parameter log output completion signal;

[0010] Based on the request parameter log output completion signal, logically process the business interface corresponding to the business interface call request to obtain a logic processing end signal;

[0011] In the continuous process of performing logical processing on the business interface corresponding to the business interface call request, determining whether a thread needs to be created, and when a thread needs to be created, obtaining a preset thread creation rule, and creating a thread based on the main thread local variable and the main thread log storage by using a preset thread pool instantiation method and a method of overwriting an Executor object to obtain a target thread;

[0012] During the continuous process of performing logical processing on the business interface corresponding to the business interface call request, determining whether there is a component call, and when there is a component call, updating the target link identifier to the Feign request header according to the main thread local variable based on the Feign request interceptor;

[0013] Based on the AOP annotation and the logic processing end signal, according to the main thread log storage, the business interface corresponding to the business interface call request is output with return parameters to obtain the interface return parameters and the return parameter output completion signal;

[0014] In the Spring interface interceptor, a completion signal is output based on the return parameter, the target link identifier is deleted from the main thread local variable and the main thread log storage, and the main thread end signal is obtained. Based on the main thread end signal, the interface return parameter is sent to the target client.

[0015] Preferably, the step of obtaining a request header from the business interface call request based on the Spring interface interceptor, parsing the obtained request header and determining whether a link identifier exists includes:

[0016] Obtaining a request header from the business interface call request based on the Spring interface interceptor;

[0017] The Spring interface interceptor is used to obtain the link identifier from the request header. When the acquisition is successful, it is determined that the link identifier exists. When the acquisition fails, it is determined that the link identifier does not exist.

[0018] Preferably, the regenerating a link identifier as the target link identifier includes:

[0019] A link identifier is generated by using a snowflake algorithm, the data format of the generated link identifier is converted from a long type to a String type, and the link identifier converted to a String type is used as the target link identifier.

[0020] Preferably, based on the main thread local variables and the main thread log storage, a preset thread pool instantiation method and a method of overwriting the Executor object are used to create a thread to obtain a target thread, including:

[0021] The thread pool is instantiated using a preset thread pool instantiation method to obtain a target instantiated thread pool;

[0022] Based on the target instantiated thread pool, overwrite the Executor method to obtain the overwritten Executor method;

[0023] Based on the thread variable management toolkit and the overwritten Executor method, a thread is created in the thread pool after the target is instantiated to obtain the thread to be set;

[0024] Copying the MDC from the main thread log storage, and updating the copied MDC to the thread to be set;

[0025] Parsing the MDC in the thread to be set and determining whether the target link identifier exists;

[0026] When the target link identifier does not exist in the MDC in the thread to be set, acquiring the target link identifier from a local variable of the thread to be set;

[0027] The acquired target link identifier is assigned to the local variable and MDC of the thread to be set to obtain the target thread.

[0028] Preferably, the method of overwriting the Executor method based on the thread pool instantiated by the target to obtain the overwritten Executor method further includes:

[0029] Get the preset TaskExecutor implementation class and the overridden ThreadPoolTaskExecutor;

[0030] Based on the instantiated thread pool of the target, the preset TaskExecutor implementation class is instantiated using the overwritten ThreadPoolTaskExecutor to obtain the implementation class to be injected;

[0031] Inject the implementation class to be injected into the Spring container to obtain the overwritten TaskExecutor;

[0032] Get the preset AsyncExecutor implementation class and the overridden ThreadPoolTaskExecutor;

[0033] Based on the instantiated thread pool of the target, the preset AsyncExecutor implementation class is instantiated using the overwritten ThreadPoolTaskExecutor to obtain the configuration class to be injected;

[0034] Inject the configuration class to be injected into the Spring container to obtain the overwritten ThreadPoolTaskExecutor;

[0035] The overwritten TaskExecutor and the overwritten ThreadPoolTaskExecutor are used as the overwritten Executor method.

[0036] Preferably, when the target link identifier does not exist in the MDC in the thread to be set, obtaining the target link identifier from the local variable of the main thread, and assigning the obtained target link identifier to the local variable and MDC of the thread to be set, comprises:

[0037] When the target link identifier does not exist in the MDC in the thread to be set, obtaining the target link identifier from the main thread local variable;

[0038] When the target link identifier is successfully obtained, the obtained target link identifier is assigned to the local variables and MDC of the thread to be set; otherwise, a link identifier is regenerated and the generated link identifier is assigned to the local variables and MDC of the thread to be set.

[0039] Preferably, the interface return parameters include: target link identifier, return parameters, and interface call time consumption.

[0040] To achieve the above object, the present invention further provides a microservice-oriented business request processing device, the device comprising:

[0041] An acquisition module is used to acquire a business interface call request sent by a target client, acquire a request header from the business interface call request based on a Spring interface interceptor, parse the acquired request header and determine whether a link identifier exists, and when the link identifier exists, use the parsed link identifier as the target link identifier, otherwise regenerate a link identifier as the target link identifier;

[0042] An assignment module, used for assigning the target link identifier to the main thread local variable and the main thread log storage respectively in the Spring interface interceptor;

[0043] A printing module, used to print interface information of the business interface corresponding to the business interface call request based on AOP annotations and the main thread log storage, and obtain a call request parameter log and a request parameter log output completion signal;

[0044] A processing module, configured to output a completion signal based on the request parameter log, perform logic processing on the business interface corresponding to the business interface call request, and obtain a logic processing end signal;

[0045] A first judgment module is used to judge whether it is necessary to create a thread during the continuous process of performing logical processing on the business interface corresponding to the business interface call request, and when it is necessary to create a thread, obtain a preset thread creation rule, and create a thread based on the main thread local variable and the main thread log storage by using a preset thread pool instantiation method and a method of overwriting an Executor object to obtain a target thread;

[0046] The second judgment module is used to judge whether there is a component call during the continuous process of performing logical processing on the business interface corresponding to the business interface call request, and when there is a component call, based on the Feign request interceptor, according to the main thread local variable, the target link identifier is updated to the Feign request header;

[0047] An output module, configured to output the return parameters of the business interface corresponding to the business interface call request based on the AOP annotation and the logic processing end signal and according to the main thread log storage, and obtain the interface return parameters and the return parameter output completion signal;

[0048] A sending module is used to output a completion signal based on the return parameter in the Spring interface interceptor, delete the target link identifier from the main thread local variable and the main thread log storage, obtain the main thread end signal, and send the interface return parameter to the target client based on the main thread end signal.

[0049] To achieve the above object, the present invention further provides an electronic device, the electronic device comprising:

[0050] at least one processor; and,

[0051] a memory communicatively connected to the at least one processor; wherein,

[0052] The memory stores a program executable by the at least one processor, and the program is executed by the at least one processor so that the at least one processor can execute the microservice-oriented business request processing method.

[0053] To achieve the above objectives, the present invention also provides a computer-readable storage medium, which stores a microservice-oriented business request processing program. When the microservice-oriented business request processing program is executed by a processor, the steps of the microservice-oriented business request processing method are implemented.

[0054] The present invention improves the business request processing method for microservices, obtains or generates a link identifier from an interface request parameter through a Spring interface interceptor, and stores the link identifier in a main thread local variable and a main thread log storage. Because the link identifier is added in the main thread log storage, the link can be tracked; AOP annotations are used to realize automatic log printing, which reduces development costs and maintenance costs, and greatly reduces code intrusion; based on a Feign request interceptor, the target link identifier in the main thread local variable is updated to the Feign request header, thereby solving the link series connection problem of Feign calls; based on the main thread local variable and the main thread log storage, a preset thread pool instantiation method and a method of overwriting an Executor object are used to realize the transfer of the link identifier to an asynchronous thread, thereby solving the technical problem of link disconnection when processing asynchronous threads; both the Spring interceptor and the Feign request interceptor avoid code intrusion. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0056] Figure 1 A schematic diagram of a preferred embodiment of the electronic device of the present invention;

[0057] Figure 2 for Figure 1A module diagram of a preferred embodiment of a microservice-oriented business request processing device;

[0058] Figure 3 A flowchart of a preferred embodiment of a microservice-oriented business request processing method of the present invention;

[0059] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0060] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0061] Reference Figure 1 FIG. 1 is a schematic diagram of a preferred embodiment of an electronic device 1 of the present invention.

[0062] The electronic device 1 includes but is not limited to: a memory 11, a processor 12, a display 13 and a network interface 14. The electronic device 1 is connected to a network through the network interface 14 to obtain raw data. The network may be a wireless or wired network such as an intranet, the Internet, a global system of mobile communication (GSM), a wideband code division multiple access (WCDMA), a 4G network, a 5G network, Bluetooth, a Wi-Fi calling network, etc.

[0063] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of the electronic device 1, such as a hard disk or memory of the electronic device 1. In other embodiments, the memory 11 may also be an external storage device of the electronic device 1, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card, etc. equipped with the electronic device 1.

[0064] Of course, the memory 11 may also include both the internal storage unit and the external storage device of the electronic device 1. In this embodiment, the memory 11 is generally used to store the operating system and various application software installed on the electronic device 1, such as the program code of the microservice-oriented business request processing program 10. In addition, the memory 11 may also be used to temporarily store various data that have been output or are to be output.

[0065] In some embodiments, the processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 12 is generally used to control the overall operation of the electronic device 1, such as performing control and processing related to data interaction or communication. In this embodiment, the processor 12 is used to run the program code stored in the memory 11 or process data, such as running the program code of the microservice-oriented business request processing program 10.

[0066] The display 13 may be referred to as a display screen or a display unit. In some embodiments, the display 13 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an organic light-emitting diode (OLED) touch device. The display 13 is used to display information processed in the electronic device 1 and to display a visual working interface, such as displaying the results of data statistics.

[0067] The network interface 14 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and the network interface 14 is generally used to establish a communication connection between the electronic device 1 and other electronic devices.

[0068] Figure 1 Only the electronic device 1 having components 11 - 14 and a microservice-oriented business request processing program 10 is shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.

[0069] Optionally, the electronic device 1 may further include a target user interface, which may include a display, an input unit such as a keyboard, and an optional target user interface may further include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an organic light-emitting diode (OLED) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visualized target user interface.

[0070] The electronic device 1 may further include a radio frequency (RF) circuit, a sensor, an audio circuit, etc., which will not be described in detail here.

[0071] In the above embodiment, the processor 12 may implement the following steps when executing the microservice-oriented business request processing program 10 stored in the memory 11:

[0072] Obtain the business interface call request sent by the target client, obtain the request header from the business interface call request based on the Spring interface interceptor, parse the obtained request header and determine whether there is a link identifier, and when the link identifier exists, use the parsed link identifier as the target link identifier, otherwise regenerate a link identifier as the target link identifier;

[0073] In the Spring interface interceptor, the target link identifier is assigned to the main thread local variable and the main thread log storage respectively;

[0074] Based on the AOP annotation and the main thread log storage, the interface information of the business interface corresponding to the business interface call request is printed to obtain a call request parameter log and a request parameter log output completion signal;

[0075] Based on the request parameter log output completion signal, logically process the business interface corresponding to the business interface call request to obtain a logic processing end signal;

[0076] In the continuous process of performing logical processing on the business interface corresponding to the business interface call request, determining whether a thread needs to be created, and when a thread needs to be created, obtaining a preset thread creation rule, and creating a thread based on the main thread local variable and the main thread log storage by using a preset thread pool instantiation method and a method of overwriting an Executor object to obtain a target thread;

[0077] During the continuous process of performing logical processing on the business interface corresponding to the business interface call request, determining whether there is a component call, and when there is a component call, updating the target link identifier to the Feign request header according to the main thread local variable based on the Feign request interceptor;

[0078] Based on the AOP annotation and the logic processing end signal, according to the main thread log storage, the business interface corresponding to the business interface call request is output with return parameters to obtain the interface return parameters and the return parameter output completion signal;

[0079] In the Spring interface interceptor, a completion signal is output based on the return parameter, the target link identifier is deleted from the main thread local variable and the main thread log storage, and the main thread end signal is obtained. Based on the main thread end signal, the interface return parameter is sent to the target client.

[0080] For a detailed description of the above steps, please refer to the following Figure 2 Functional module diagram of an embodiment of a microservice-oriented business request processing device 100 and Figure 3 Description of a flowchart of an embodiment of a method for processing business requests for microservices.

[0081] Reference Figure 2 , which is a functional module diagram of a microservice-oriented business request processing device 100 of the present invention.

[0082] The microservice-oriented business request processing device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the microservice-oriented business request processing device 100 can include an acquisition module 110, an assignment module 120, a printing module 130, a processing module 140, a first judgment module 150, a second judgment module 160, an output module 170 and a sending module 180. The module of the present invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.

[0083] In this embodiment, the functions of each module / unit are as follows:

[0084] The acquisition module 110 is used to obtain the business interface call request sent by the target client, and based on the Spring interface interceptor, obtain the request header from the business interface call request, parse the obtained request header and determine whether there is a link identifier. When the link identifier exists, the parsed link identifier is used as the target link identifier, otherwise a link identifier is regenerated as the target link identifier.

[0085] In this embodiment, the target client is the client. The client can be a client of a mobile electronic device or a client of a computer. The business interface call request is a request for calling a business interface. In a microservice environment, the business interface can be an interface service composed of multiple components. The business interface call request includes two parts: a header and a body. The header is the request header, and the body is the request body. The request header contains parameters such as content-type. Spring interface interceptor is a type of Spring interceptor. Spring interceptor is an application of Spring Aop. It executes a piece of code without modifying the source code to enhance the existing method. The interface interception function is implemented by customizing the interceptor and injecting it into the Spring container.

[0086] Wherein, the Spring interface interceptor is based on obtaining a request header from the business interface call request, parsing the obtained request header and determining whether there is a link identifier, including:

[0087] Obtaining a request header from the business interface call request based on the Spring interface interceptor;

[0088] The Spring interface interceptor is used to obtain the link identifier from the request header. When the acquisition is successful, it is determined that the link identifier exists. When the acquisition fails, it is determined that the link identifier does not exist.

[0089] The step of regenerating a link identifier as the target link identifier includes:

[0090] A link identifier is generated by using a snowflake algorithm, the data format of the generated link identifier is converted from a long type to a String type, and the link identifier converted to a String type is used as the target link identifier.

[0091] The assignment module 120 is used to assign the target link identifier to the main thread local variable and the main thread log storage in the Spring interface interceptor.

[0092] In this embodiment, in the Spring interface interceptor, based on the thread variable management toolkit, the target link identifier is assigned to the main thread local variable and the main thread log storage respectively. The thread variable management toolkit is a toolkit that can pass the local variables of the parent thread (that is, the main thread) to the child thread, such as the TransmittableThreadLocal (toolkit) of Alibaba (company). The main thread local variable is the local variable of the main thread.

[0093] The printing module 130 is used to print the interface information of the business interface corresponding to the business interface call request based on the AOP annotation and the main thread log storage, and obtain the call request parameter log and the request parameter log output completion signal.

[0094] In this embodiment, the AOP (Aspect Oriented Thinking) annotation method is adopted to add the defined AOP annotation to the business interface, so that the interface information printing of the business interface corresponding to the business interface call request can be realized.

[0095] The AOP parameters of the AOP annotation include: interface description, whether to print input parameters, and whether to print output parameters.

[0096] Among them, the AOP annotation method is adopted to add the AOP annotation of the defined interface information printing to the business interface, and based on the target link identifier in the main thread log storage, the interface information of the business interface corresponding to the business interface call request is printed, and the request uri, the customized request description, url, the requested parameters, and the target link identifier are printed out. After the printing is completed, the request parameter log output completion signal is generated, and the printed request uri, the customized request description, url, the requested parameters, and the target link identifier are used as the call request parameter log. The requested parameters include: input parameter name and input parameter value. The AOP annotation-based method does not directly interfere with the code operation. Regardless of adding or deleting annotations, the interface code can run normally, reducing the complexity of the code, reducing the coupling of the code, and avoiding problems caused by interface information printing, thereby solving the technical problem of code intrusion caused by the target link identifier being passed to the method of the called component.

[0097] For example, the original interface definition is: @GetMapping(" / demo")Public String demo(). Using AOP annotation, the defined AOP annotation is added to the business interface. After adding the Aop with the minimum principle input parameters, it becomes: @GetMapping(" / demo")@ApiLogger(description="demo")Public String demo(). This example is not limited to this.

[0098] The processing module 140 is used to output a completion signal based on the request parameter log, perform logic processing on the business interface corresponding to the business interface call request, and obtain a logic processing end signal.

[0099] In this embodiment, based on the request parameter log output completion signal, the interface business logic code of the business interface corresponding to the business interface call request is executed to implement logic processing, and the interface business logic code generates a logic processing end signal after the execution is completed.

[0100] The first judgment module 150 is used to judge whether it is necessary to create a thread during the continuous process of performing logical processing on the business interface corresponding to the business interface call request. When a thread needs to be created, it obtains the preset thread creation rule, and based on the main thread local variables and the main thread log storage, uses the preset thread pool instantiation method and the method of overwriting the Executor object to create a thread to obtain the target thread.

[0101] In this embodiment, in the process of continuing to perform logical processing on the business interface corresponding to the business interface call request, based on the main thread local variables and the main thread log storage, a thread creation method of overwriting the thread pool is adopted to create a thread, and the created thread is used as the target thread. The target thread can be an asynchronous thread, and the target link identifier is passed to the asynchronous thread, thereby achieving the purpose of link tracking for the asynchronous thread, avoiding the technical problem of link disconnection when processing the asynchronous thread.

[0102] The thread pool's thread creation methods include: ThreadPoolExecutor, ThreadPoolTaskScheduler, ThreadPoolTaskExecutor. ThreadPoolTaskScheduler is the thread pool task scheduling class.

[0103] Optionally, based on the main thread local variables and the main thread log storage, a preset thread pool instantiation method and a method of overwriting an Executor object are used to create a thread to obtain a target thread, including:

[0104] The thread pool is instantiated using a preset thread pool instantiation method to obtain a target instantiated thread pool;

[0105] Based on the target instantiated thread pool, overwrite the Executor method to obtain the overwritten Executor method;

[0106] Based on the thread variable management toolkit and the overwritten Executor method, a thread is created in the thread pool after the target is instantiated to obtain the thread to be set;

[0107] Copying the MDC from the main thread log storage, and updating the copied MDC to the thread to be set;

[0108] Parsing the MDC in the thread to be set and determining whether the target link identifier exists;

[0109] When the target link identifier does not exist in the MDC in the thread to be set, acquiring the target link identifier from a local variable of the thread to be set;

[0110] The acquired target link identifier is assigned to the local variable and MDC of the thread to be set to obtain the target thread.

[0111] Optionally, the overwriting of the Executor method based on the instantiated thread pool of the target to obtain the overwritten Executor method further includes:

[0112] Get the preset TaskExecutor implementation class and the overridden ThreadPoolTaskExecutor;

[0113] Based on the instantiated thread pool of the target, the preset TaskExecutor implementation class is instantiated using the overwritten ThreadPoolTaskExecutor to obtain the implementation class to be injected;

[0114] Inject the implementation class to be injected into the Spring container to obtain the overwritten TaskExecutor;

[0115] Get the preset AsyncExecutor implementation class and the overridden ThreadPoolTaskExecutorT;

[0116] Based on the instantiated thread pool of the target, the preset AsyncExecutor implementation class is instantiated using the overwritten ThreadPoolTaskExecutor to obtain the configuration class to be injected;

[0117] Inject the configuration class to be injected into the Spring container to obtain the overwritten ThreadPoolTaskExecutor; use the overwritten TaskExecutor and the overwritten ThreadPoolTaskExecutor as the overwritten Executor method.

[0118] Optionally, when the target link identifier does not exist in the MDC in the thread to be set, obtaining the target link identifier from the local variable of the main thread, and assigning the obtained target link identifier to the local variable and MDC of the thread to be set, comprises:

[0119] When the target link identifier does not exist in the MDC in the thread to be set, obtaining the target link identifier from the main thread local variable;

[0120] When the target link identifier is successfully obtained, the obtained target link identifier is assigned to the local variables and MDC of the thread to be set; otherwise, a link identifier is regenerated and the generated link identifier is assigned to the local variables and MDC of the thread to be set.

[0121] The implementation class to be injected is the custom TaskExecutor. The configuration class to be injected is the configuration class that inherits AsyncConfigurerSupport.

[0122] MDC, or Mapped Diagnostic Context, is a class provided by log4j and logback to facilitate logging in multi-threaded conditions. MDC log enhancements, if MDC is configured and the corresponding key-value pairs are added, the value corresponding to the key can be printed out when printing logs. MDC is implemented internally with ThreadLocal, which can carry the context information of the current thread.

[0123] The second judgment module 160 is used to determine whether there is a component call during the continuous process of performing logical processing on the business interface corresponding to the business interface call request. When there is a component call, based on the Feign request interceptor, the target link identifier is updated to the Feign request header according to the main thread local variable.

[0124] In this embodiment, in Springcloud, microservices generally use Feign (Feign is a declarative, templated HTTP client developed by Netflix, which calls HTTP API more conveniently and elegantly) to call each other, so the calls between components use Feign requests.

[0125] Among them, in the continuous process of performing logical processing on the business interface corresponding to the business interface call request, it is determined whether there is a component call. When there is a component call, the Feign request header is obtained based on the Feign request interceptor; the target link identifier is obtained from the local variable of the main thread, and the obtained target link identifier is updated to the Feign request header, thereby realizing the passing of the target link identifier to the called component.

[0126] The output module 170 is used to output the return parameters of the business interface corresponding to the business interface call request based on the AOP annotation, the logic processing end signal, and the main thread log storage, and obtain the interface return parameters and the return parameter output completion signal.

[0127] In this embodiment, in response to the logic processing end signal, the AOP annotation of the defined return parameter is added to the business interface by means of AOP annotation; according to the target link identifier in the main thread log storage, the return parameter of the business interface corresponding to the business interface call request is output to obtain the interface return parameter, and the return parameter output completion signal is generated after the return parameter output is completed. The interface return parameter refers to the return result of the business interface call request calling the business interface. The interface return parameters include: target link identifier, return parameter, and interface call time.

[0128] The sending module 180 is used to output a completion signal based on the return parameter in the Spring interface interceptor, delete the target link identifier from the main thread local variable and the main thread log storage, obtain the main thread end signal, and send the interface return parameter to the target client based on the main thread end signal.

[0129] In this embodiment, in the Spring interface interceptor, in response to the return parameter output completion signal, the target link identifier is deleted from the main thread local variable and the main thread log storage, and the main thread end signal is generated after the target link identifier is deleted. In response to the main thread end signal, the interface return parameter is sent to the target client according to the business interface call request.

[0130] In this embodiment, the link identifier is obtained or generated from the interface request parameters through the Spring interface interceptor, and the link identifier is stored in the main thread local variable and the main thread log storage. Because the link identifier is added in the main thread log storage, the link can be tracked; AOP annotations are used to realize automatic log printing, which reduces development costs and maintenance costs, and greatly reduces code intrusion; based on the Feign request interceptor, the target link identifier in the main thread local variable is updated to the Feign request header, thereby solving the link series connection problem of Feign calls; based on the main thread local variable and the main thread log storage, the preset thread pool instantiation method and the method of overwriting the Executor object are used to realize the transfer of the link identifier to the asynchronous thread, thereby solving the technical problem of link disconnection when processing asynchronous threads; both the Spring interceptor and the Feign request interceptor avoid code intrusion.

[0131] In addition, the present invention also provides a microservice-oriented business request processing method. Figure 3 As shown, it is a method flow diagram of an embodiment of the microservice-oriented business request processing method of the present invention. When the processor 12 of the electronic device 1 executes the microservice-oriented business request processing program 10 stored in the memory 11, the microservice-oriented business request processing method is implemented, including steps S101-S108. Each step is described in detail below.

[0132] S101, obtain the business interface call request sent by the target client, based on the Spring interface interceptor, obtain the request header from the business interface call request, parse the obtained request header and determine whether there is a link identifier. When the link identifier exists, the parsed link identifier is used as the target link identifier, otherwise a link identifier is regenerated as the target link identifier.

[0133] In this embodiment, the target client is the client. The client can be a client of a mobile electronic device or a client of a computer. The business interface call request is a request for calling a business interface. In a microservice environment, the business interface can be an interface service composed of multiple components. The business interface call request includes two parts: a header and a body. The header is the request header, and the body is the request body. The request header contains parameters such as content-type. Spring interface interceptor is a type of Spring interceptor. Spring interceptor is an application of Spring Aop. It executes a piece of code without modifying the source code to enhance the existing method. The interface interception function is implemented by customizing the interceptor and injecting it into the Spring container.

[0134] Wherein, the Spring interface interceptor is based on obtaining a request header from the business interface call request, parsing the obtained request header and determining whether there is a link identifier, including:

[0135] Obtaining a request header from the business interface call request based on the Spring interface interceptor;

[0136] The Spring interface interceptor is used to obtain the link identifier from the request header. When the acquisition is successful, it is determined that the link identifier exists. When the acquisition fails, it is determined that the link identifier does not exist.

[0137] The step of regenerating a link identifier as the target link identifier includes:

[0138] A link identifier is generated by using a snowflake algorithm, the data format of the generated link identifier is converted from a long type to a String type, and the link identifier converted to a String type is used as the target link identifier.

[0139] S102, in the Spring interface interceptor, assigning the target link identifier to the main thread local variable and the main thread log storage respectively.

[0140] In this embodiment, in the Spring interface interceptor, based on the thread variable management toolkit, the target link identifier is assigned to the main thread local variable and the main thread log storage respectively. The thread variable management toolkit is a toolkit that can pass the local variables of the parent thread (that is, the main thread) to the child thread, such as the TransmittableThreadLocal (toolkit) of Alibaba (company). The main thread local variable is the local variable of the main thread.

[0141] S103, based on the AOP annotation and the main thread log storage, printing the interface information of the business interface corresponding to the business interface call request, and obtaining a call request parameter log and a request parameter log output completion signal.

[0142] In this embodiment, the AOP (Aspect Oriented Thinking) annotation method is adopted to add the defined AOP annotation to the business interface, so that the interface information printing of the business interface corresponding to the business interface call request can be realized.

[0143] The AOP parameters of the AOP annotation include: interface description, whether to print input parameters, and whether to print output parameters.

[0144] Among them, the AOP annotation method is adopted to add the AOP annotation of the defined interface information printing to the business interface, and based on the target link identifier in the main thread log storage, the interface information of the business interface corresponding to the business interface call request is printed, and the request uri, the customized request description, url, the requested parameters, and the target link identifier are printed out. After the printing is completed, the request parameter log output completion signal is generated, and the printed request uri, the customized request description, url, the requested parameters, and the target link identifier are used as the call request parameter log. The requested parameters include: input parameter name and input parameter value. The AOP annotation-based method does not directly interfere with the code operation. Regardless of adding or deleting annotations, the interface code can run normally, reducing the complexity of the code, reducing the coupling of the code, and avoiding problems caused by interface information printing, thereby solving the technical problem of code intrusion caused by the target link identifier being passed to the method of the called component.

[0145] For example, the original interface definition is: @GetMapping(" / demo")Public String demo(). Using AOP annotation, the defined AOP annotation is added to the business interface. After adding the Aop with the minimum principle input parameters, it becomes: @GetMapping(" / demo")@ApiLogger(description="demo")Public String demo(). This example is not limited to this.

[0146] S104: Based on the request parameter log output completion signal, perform logic processing on the business interface corresponding to the business interface call request to obtain a logic processing end signal.

[0147] In this embodiment, based on the request parameter log output completion signal, the interface business logic code of the business interface corresponding to the business interface call request is executed to implement logic processing, and the interface business logic code generates a logic processing end signal after the execution is completed.

[0148] S105, during the continuous process of performing logical processing on the business interface corresponding to the business interface call request, determine whether it is necessary to create a thread. When it is necessary to create a thread, obtain the preset thread creation rule, and based on the main thread local variables and the main thread log storage, use the preset thread pool instantiation method and the method of overriding the Executor object to create a thread to obtain the target thread.

[0149] In this embodiment, in the process of continuing to perform logical processing on the business interface corresponding to the business interface call request, based on the main thread local variables and the main thread log storage, a thread creation method of overwriting the thread pool is adopted to create a thread, and the created thread is used as the target thread. The target thread can be an asynchronous thread, and the target link identifier is passed to the asynchronous thread, thereby achieving the purpose of link tracking for the asynchronous thread, avoiding the technical problem of link disconnection when processing the asynchronous thread.

[0150] The thread pool's thread creation methods include: ThreadPoolExecutor, ThreadPoolTaskScheduler, ThreadPoolTaskExecutor. ThreadPoolTaskScheduler is the thread pool task scheduling class.

[0151] Optionally, based on the main thread local variables and the main thread log storage, a preset thread pool instantiation method and a method of overwriting an Executor object are used to create a thread to obtain a target thread, including:

[0152] The thread pool is instantiated using a preset thread pool instantiation method to obtain a target instantiated thread pool;

[0153] Based on the target instantiated thread pool, overwrite the Executor method to obtain the overwritten Executor method;

[0154] Based on the thread variable management toolkit and the overwritten Executor method, a thread is created in the thread pool after the target is instantiated to obtain the thread to be set;

[0155] Copying the MDC from the main thread log storage, and updating the copied MDC to the thread to be set;

[0156] Parsing the MDC in the thread to be set and determining whether the target link identifier exists;

[0157] When the target link identifier does not exist in the MDC in the thread to be set, acquiring the target link identifier from a local variable of the thread to be set;

[0158] The acquired target link identifier is assigned to the local variable and MDC of the thread to be set to obtain the target thread.

[0159] Optionally, the overwriting of the Executor method based on the instantiated thread pool of the target to obtain the overwritten Executor method further includes:

[0160] Get the preset TaskExecutor implementation class and the overridden ThreadPoolTaskExecutor;

[0161] Based on the instantiated thread pool of the target, the preset TaskExecutor implementation class is instantiated using the overwritten ThreadPoolTaskExecutor to obtain the implementation class to be injected;

[0162] Inject the implementation class to be injected into the Spring container to obtain the overwritten TaskExecutor;

[0163] Get the preset AsyncExecutor implementation class and the overridden ThreadPoolTaskExecutorT;

[0164] Based on the instantiated thread pool of the target, the preset AsyncExecutor implementation class is instantiated using the overwritten ThreadPoolTaskExecutor to obtain the configuration class to be injected;

[0165] Inject the configuration class to be injected into the Spring container to obtain the overwritten ThreadPoolTaskExecutor; use the overwritten TaskExecutor and the overwritten ThreadPoolTaskExecutor as the overwritten Executor method.

[0166] Optionally, when the target link identifier does not exist in the MDC in the thread to be set, obtaining the target link identifier from the local variable of the main thread, and assigning the obtained target link identifier to the local variable and MDC of the thread to be set, comprises:

[0167] When the target link identifier does not exist in the MDC in the thread to be set, obtaining the target link identifier from the main thread local variable;

[0168] When the target link identifier is successfully obtained, the obtained target link identifier is assigned to the local variables and MDC of the thread to be set; otherwise, a link identifier is regenerated and the generated link identifier is assigned to the local variables and MDC of the thread to be set.

[0169] The implementation class to be injected is the custom TaskExecutor. The configuration class to be injected is the configuration class that inherits AsyncConfigurerSupport.

[0170] MDC, or Mapped Diagnostic Context, is a class provided by log4j and logback to facilitate logging in multi-threaded conditions. MDC log enhancements, if MDC is configured and the corresponding key-value pairs are added, the value corresponding to the key can be printed out when printing logs. MDC is implemented internally with ThreadLocal, which can carry the context information of the current thread.

[0171] S106, during the continuous process of performing logical processing on the business interface corresponding to the business interface call request, determine whether there is a component call. When there is a component call, based on the Feign request interceptor, update the target link identifier to the Feign request header according to the main thread local variable.

[0172] In this embodiment, in Springcloud, microservices generally use Feign (Feign is a declarative, templated HTTP client developed by Netflix, which calls HTTP API more conveniently and elegantly) to call each other, so the calls between components use Feign requests.

[0173] Among them, in the continuous process of performing logical processing on the business interface corresponding to the business interface call request, it is determined whether there is a component call. When there is a component call, the Feign request header is obtained based on the Feign request interceptor; the target link identifier is obtained from the local variable of the main thread, and the obtained target link identifier is updated to the Feign request header, thereby realizing the passing of the target link identifier to the called component.

[0174] S107, based on the AOP annotation and the logic processing end signal, according to the main thread log storage, output the return parameters of the business interface corresponding to the business interface call request to obtain the interface return parameters and the return parameter output completion signal.

[0175] In this embodiment, in response to the logic processing end signal, the AOP annotation of the defined return parameter is added to the business interface by means of AOP annotation; according to the target link identifier in the main thread log storage, the return parameter of the business interface corresponding to the business interface call request is output to obtain the interface return parameter, and the return parameter output completion signal is generated after the return parameter output is completed. The interface return parameter refers to the return result of the business interface call request calling the business interface. The interface return parameters include: target link identifier, return parameter, and interface call time.

[0176] S108, in the Spring interface interceptor, a completion signal is output based on the return parameter, the target link identifier is deleted from the main thread local variable and the main thread log storage, and the main thread end signal is obtained; based on the main thread end signal, the interface return parameter is sent to the target client.

[0177] In this embodiment, in the Spring interface interceptor, in response to the return parameter output completion signal, the target link identifier is deleted from the main thread local variable and the main thread log storage, and the main thread end signal is generated after the target link identifier is deleted. In response to the main thread end signal, the interface return parameter is sent to the target client according to the business interface call request.

[0178] In this embodiment, the link identifier is obtained or generated from the interface request parameters through the Spring interface interceptor, and the link identifier is stored in the main thread local variable and the main thread log storage. Because the link identifier is added in the main thread log storage, the link can be tracked; AOP annotations are used to realize automatic log printing, which reduces development costs and maintenance costs, and greatly reduces code intrusion; based on the Feign request interceptor, the target link identifier in the main thread local variable is updated to the Feign request header, thereby solving the link series connection problem of Feign calls; based on the main thread local variable and the main thread log storage, the preset thread pool instantiation method and the method of overwriting the Executor object are used to realize the transfer of the link identifier to the asynchronous thread, thereby solving the technical problem of link disconnection when processing asynchronous threads; both the Spring interceptor and the Feign request interceptor avoid code intrusion.

[0179] In addition, the embodiment of the present invention further proposes a computer-readable storage medium, which may be any one or any combination of a hard disk, a multimedia card, an SD card, a flash memory card, an SMC, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), a USB memory, etc. The computer-readable storage medium includes a data storage area and a program storage area, the data storage area stores data created according to the use of the blockchain node, and the program storage area stores a microservice-oriented business request processing program 10. When the microservice-oriented business request processing program 10 is executed by the processor, the operation of the microservice-oriented business request processing method is implemented.

[0180] In another embodiment, the microservice-oriented business request processing method provided by the present invention can further ensure the privacy and security of all the above-mentioned data, and all the above-mentioned data can also be stored in a node of a blockchain.

[0181] It should be noted that the blockchain referred to in the present invention is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, platform product service layer, and application service layer.

[0182] The specific implementation of the computer-readable storage medium of the present invention is roughly the same as the specific implementation of the above-mentioned microservice-oriented business request processing method, and will not be repeated here.

[0183] It should be noted that the serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof herein are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the existence of other identical elements in the process, device, article or method including the element.

[0184] It should be noted that the above embodiments of the present invention can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0185] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0186] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for enabling an electronic device (which can be a mobile phone, a computer, an electronic device, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0187] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A business request processing method for microservices, It is characterized in that The method comprises: Obtain the business interface call request sent by the target client, obtain the request header from the business interface call request based on the Spring interface interceptor, parse the obtained request header and determine whether there is a link identifier, and when the link identifier exists, use the parsed link identifier as the target link identifier, otherwise regenerate a link identifier as the target link identifier; In the Spring interface interceptor, the target link identifier is assigned to the main thread local variable and the main thread log storage respectively; Based on the AOP annotation and the main thread log storage, the interface information of the business interface corresponding to the business interface call request is printed to obtain a call request parameter log and a request parameter log output completion signal; Based on the request parameter log output completion signal, logically process the business interface corresponding to the business interface call request to obtain a logic processing end signal; In the continuous process of performing logical processing on the business interface corresponding to the business interface call request, determining whether a thread needs to be created, and when a thread needs to be created, obtaining a preset thread creation rule, and creating a thread based on the main thread local variable and the main thread log storage by using a preset thread pool instantiation method and a method of overwriting an Executor object to obtain a target thread; During the continuous process of performing logical processing on the business interface corresponding to the business interface call request, determining whether there is a component call, and when there is a component call, updating the target link identifier to the Feign request header according to the main thread local variable based on the Feign request interceptor; Based on the AOP annotation and the logic processing end signal, according to the main thread log storage, the business interface corresponding to the business interface call request is output with return parameters to obtain the interface return parameters and the return parameter output completion signal; In the Spring interface interceptor, a completion signal is output based on the return parameter, the target link identifier is deleted from the main thread local variable and the main thread log storage, and the main thread end signal is obtained. Based on the main thread end signal, the interface return parameter is sent to the target client.

2. The microservice-oriented business request processing method according to claim 1, It is characterized in that The Spring interface interceptor is based on obtaining a request header from the business interface call request, parsing the obtained request header and determining whether there is a link identifier, including: Obtaining a request header from the business interface call request based on the Spring interface interceptor; The Spring interface interceptor is used to obtain the link identifier from the request header. When the acquisition is successful, it is determined that the link identifier exists. When the acquisition fails, it is determined that the link identifier does not exist.

3. The microservice-oriented business request processing method according to claim 1, It is characterized in that The regenerating a link identifier as the target link identifier includes: A link identifier is generated by using a snowflake algorithm, the data format of the generated link identifier is converted from a long type to a String type, and the link identifier converted to a String type is used as the target link identifier.

4. The microservice-oriented business request processing method according to claim 1, It is characterized in that Based on the main thread local variables and the main thread log storage, a preset thread pool instantiation method and a method of overwriting the Executor object are used to create a thread to obtain a target thread, including: The thread pool is instantiated using a preset thread pool instantiation method to obtain a target instantiated thread pool; Based on the target instantiated thread pool, overwrite the Executor method to obtain the overwritten Executor method; Based on the thread variable management toolkit and the overwritten Executor method, a thread is created in the thread pool after the target is instantiated to obtain the thread to be set; Copying the MDC from the main thread log storage, and updating the copied MDC to the thread to be set; Parsing the MDC in the thread to be set and determining whether the target link identifier exists; When the target link identifier does not exist in the MDC in the thread to be set, acquiring the target link identifier from a local variable of the thread to be set; The acquired target link identifier is assigned to the local variable and MDC of the thread to be set to obtain the target thread.

5. The microservice-oriented business request processing method according to claim 1, It is characterized in that The thread pool instantiated based on the target is overwritten with the Executor method to obtain the overwritten Executor method, and further includes: Get the preset TaskExecutor implementation class and the overridden ThreadPoolTaskExecutor; Based on the instantiated thread pool of the target, the preset TaskExecutor implementation class is instantiated using the overwritten ThreadPoolTaskExecutor to obtain the implementation class to be injected; Inject the implementation class to be injected into the Spring container to obtain the overwritten TaskExecutor; Get the preset AsyncExecutor implementation class and the overridden ThreadPoolTaskExecutor; Based on the instantiated thread pool of the target, the preset AsyncExecutor implementation class is instantiated using the overwritten ThreadPoolTaskExecutor to obtain the configuration class to be injected; Inject the configuration class to be injected into the Spring container to obtain the overwritten ThreadPoolTaskExecutor; The overwritten TaskExecutor and the overwritten ThreadPoolTaskExecutor are used as the overwritten Executor method.

6. The microservice-oriented business request processing method according to claim 4, It is characterized in that When the target link identifier does not exist in the MDC in the thread to be set, obtaining the target link identifier from the local variable of the main thread, and assigning the obtained target link identifier to the local variable and MDC of the thread to be set, including: When the target link identifier does not exist in the MDC in the thread to be set, obtaining the target link identifier from the main thread local variable; When the target link identifier is successfully obtained, the obtained target link identifier is assigned to the local variables and MDC of the thread to be set; otherwise, a link identifier is regenerated and the generated link identifier is assigned to the local variables and MDC of the thread to be set.

7. The microservice-oriented business request processing method according to claim 1, It is characterized in that The interface return parameters include: target link identifier, return parameters, and interface call time consumption.

8. A business request processing device for microservices, It is characterized in that The device comprises: An acquisition module is used to acquire a business interface call request sent by a target client, acquire a request header from the business interface call request based on a Spring interface interceptor, parse the acquired request header and determine whether a link identifier exists, and when the link identifier exists, use the parsed link identifier as the target link identifier, otherwise regenerate a link identifier as the target link identifier; An assignment module, used for assigning the target link identifier to the main thread local variable and the main thread log storage respectively in the Spring interface interceptor; A printing module, used to print interface information of the business interface corresponding to the business interface call request based on AOP annotations and the main thread log storage, and obtain a call request parameter log and a request parameter log output completion signal; A processing module, configured to output a completion signal based on the request parameter log, perform logic processing on the business interface corresponding to the business interface call request, and obtain a logic processing end signal; A first judgment module is used to judge whether it is necessary to create a thread during the continuous process of performing logical processing on the business interface corresponding to the business interface call request, and when it is necessary to create a thread, obtain a preset thread creation rule, and create a thread based on the main thread local variable and the main thread log storage by using a preset thread pool instantiation method and a method of overwriting an Executor object to obtain a target thread; The second judgment module is used to judge whether there is a component call during the continuous process of performing logical processing on the business interface corresponding to the business interface call request, and when there is a component call, based on the Feign request interceptor, the target link identifier is updated to the Feign request header according to the main thread local variable; An output module, configured to output the return parameters of the business interface corresponding to the business interface call request based on the AOP annotation and the logic processing end signal and according to the main thread log storage, and obtain the interface return parameters and the return parameter output completion signal; A sending module is used to output a completion signal based on the return parameter in the Spring interface interceptor, delete the target link identifier from the main thread local variable and the main thread log storage, obtain the main thread end signal, and send the interface return parameter to the target client based on the main thread end signal.

9. An electronic device, It is characterized in that The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a program executable by the at least one processor, and the program is executed by the at least one processor so that the at least one processor can execute the microservice-oriented business request processing method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a microservice-oriented business request processing program. When the microservice-oriented business request processing program is executed by a processor, the steps of the microservice-oriented business request processing method according to any one of claims 1 to 7 are implemented.