Asynchronous task data processing method, device and computer readable storage medium
Patent Information
- Application Number
- CN201910970982.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-12
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2039-10-12
AI Technical Summary
所述通过异步任务的方式处理的缺点包括:1、强依赖数据库,高并发下对数据库压力增大;2、大量的任务积压会影响任务的处理速度
[0039] The asynchronous task data processing method, device and computer-readable storage medium proposed by the present invention, when the user performs asynchronous task data processing, combines with the pre-built asynchronous message server to analyze, summarize and consume the asynchronous task data, and obtain The target message set is transmitted to the background database to obtain the query results of the target message set, thereby enabling efficient processing of asynchronous task data.
Smart Images

Figure CN110851248B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to an asynchronous task data processing method, device and computer-readable storage medium. Background Art
[0002] At present, most architectures based on oracle data storage media cannot meet the needs of high-concurrency business volume processing. Some data with low real-time requirements will be processed through asynchronous tasks. The processing steps through asynchronous tasks are: first write a task to be processed in the oracle database; then use a scheduled task to capture the asynchronous task data in the database to process the business logic. The disadvantages of processing through asynchronous tasks include: 1. Strong dependence on the database, which increases the pressure on the database under high concurrency; 2. A large number of task backlogs will affect the processing speed of tasks. Summary of the invention
[0003] The present invention provides an asynchronous task data processing method, device and computer-readable storage medium, the main purpose of which is to provide a user with an efficient asynchronous task data processing method when the user is processing asynchronous task data.
[0004] To achieve the above object, the present invention provides an asynchronous task data processing method, comprising:
[0005] Acquire asynchronous task data to be processed by the client, and input the asynchronous task data into a pre-built asynchronous message server, wherein the asynchronous message server includes a producer, a manager, and a consumer, and the producer and the consumer are respectively connected to the manager;
[0006] The producer parses the asynchronous task data to obtain a message set of the asynchronous task data;
[0007] The manager aggregates and processes the message set of the asynchronous task data to obtain a source message set;
[0008] The consumer consumes and subscribes to the source message set to obtain a target message set;
[0009] The target message set is transmitted to a background database, a query result of the target message set is obtained, and the query result is returned to the client through the asynchronous message server.
[0010] Optionally, the pre-built asynchronous message server includes RocketMQ message middleware; and establishing connections between the producer and the consumer and the manager respectively includes:
[0011] Open a first channel between the producer and the manager, declare a first switch through the first channel, declare a first message queue between the producer and the manager, bind the first switch and the first queue by using a routing key, and establish a connection between the producer and the manager;
[0012] A second channel is opened between the consumer and the manager, a second switch is declared through the second channel, a second message queue is declared between the consumer and the manager, and the second switch and the second queue are bound by a routing key to establish a connection between the consumer and the manager.
[0013] Optionally, the parsing process includes:
[0014] The asynchronous task data is filtered, and the filtered asynchronous task data is added, deleted, changed and viewed through operation and maintenance instructions according to user needs to complete the parsing process.
[0015] Optionally, the manager includes a Broker module and a Name Server module; and the manager aggregates and processes the message set of the asynchronous task data to obtain a source message set, including:
[0016] Transmitting the message set of the asynchronous task data to the Broker module, and periodically obtaining the message set topic routing information of the asynchronous task data from the NameServer module;
[0017] Parsing the message set topic routing information through the Namesrv Startup class in the Name Server module to obtain information of each node in the message set of the asynchronous task data;
[0018] The Default Request Processor class in the Broker module is used to define the communication protocol between the nodes in the message set, and the respective processing information in the message set of the asynchronous task data is called according to the communication protocol, and the message set of the asynchronous task data is aggregated and processed to obtain the source message set.
[0019] Optionally, the consuming and subscribing to the source message set by the consumer includes:
[0020] Preset the source data set node address of the Name Server module in the manager, and traverse the subject and label of the source data set to obtain the standard data set of the source data set;
[0021] Allocating a consumption queue to the standard data set by a preset allocation strategy;
[0022] The consumer periodically sends a consumption request to the manager, and searches for data in the consumption queue according to the consumption request to complete the consumption subscription.
[0023] In addition, to achieve the above-mentioned purpose, the present invention also provides an asynchronous task data processing device, which includes a memory and a processor, wherein the memory stores an asynchronous task data processing program that can be run on the processor, and when the asynchronous task data processing program is executed by the processor, the following steps are implemented:
[0024] Acquire asynchronous task data to be processed by the client, and input the asynchronous task data into a pre-built asynchronous message server, wherein the asynchronous message server includes a producer, a manager, and a consumer, and the producer and the consumer are respectively connected to the manager;
[0025] The producer parses the asynchronous task data to obtain a message set of the asynchronous task data;
[0026] The manager aggregates and processes the message set of the asynchronous task data to obtain a source message set;
[0027] The consumer consumes and subscribes to the source message set to obtain a target message set;
[0028] The target message set is transmitted to a background database, a query result of the target message set is obtained, and the query result is returned to the client through the asynchronous message server.
[0029] Optionally, the pre-built asynchronous message server includes RocketMQ message middleware; and establishing connections between the producer and the consumer and the manager respectively includes:
[0030] Open a first channel between the producer and the manager, declare a first switch through the first channel, declare a first message queue between the producer and the manager, bind the first switch and the first queue by using a routing key, and establish a connection between the producer and the manager;
[0031] A second channel is opened between the consumer and the manager, a second switch is declared through the second channel, a second message queue is declared between the consumer and the manager, and the second switch and the second queue are bound by a routing key to establish a connection between the consumer and the manager.
[0032] Optionally, the parsing process includes:
[0033] The asynchronous task data is filtered, and the filtered asynchronous task data is added, deleted, changed and viewed through operation and maintenance instructions according to user needs to complete the parsing process.
[0034] Optionally, the manager includes a Broker module and a Name Server module; and the process of aggregating the message set of the asynchronous task data by the manager to obtain the source message set includes:
[0035] Transmitting the message set of the asynchronous task data to the Broker module, and periodically obtaining the message set topic routing information of the asynchronous task data from the NameServer module;
[0036] Parsing the message set topic routing information through the Namesrv Startup class in the Name Server module to obtain information of each node in the message set of the asynchronous task data;
[0037] The Default Request Processor class in the Broker module is used to define the communication protocol between the nodes in the message set, and the respective processing information in the message set of the asynchronous task data is called according to the communication protocol, and the message set of the asynchronous task data is aggregated and processed to obtain the source message set.
[0038] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which an asynchronous task data processing program is stored. The asynchronous task data processing program can be executed by one or more processors to implement the steps of the asynchronous task data processing method as described above.
[0039] The asynchronous task data processing method, device and computer-readable storage medium proposed in the present invention, when a user performs asynchronous task data processing, parse, aggregate and consume and subscribe to the asynchronous task data in combination with a pre-built asynchronous message server to obtain a target message set, and transmit the target message set to a background database to obtain a query result of the target message set, thereby realizing efficient processing of asynchronous task data. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A schematic diagram of a flow chart of an asynchronous task data processing method provided by an embodiment of the present invention;
[0041] Figure 2 A schematic diagram of the internal structure of an asynchronous task data processing device provided by an embodiment of the present invention;
[0042] Figure 3 A schematic diagram of a module of an asynchronous task data processing program in an asynchronous task data processing device provided in an embodiment of the present invention.
[0043] 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
[0044] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0045] The present invention provides an asynchronous task data processing method. Figure 1 FIG. 1 is a flow chart of an asynchronous task data processing method provided by an embodiment of the present invention. The method can be executed by a device, and the device can be implemented by software and / or hardware.
[0046] In this embodiment, the asynchronous task data processing method includes:
[0047] S1. Obtain the asynchronous task data to be processed by the client, and input the asynchronous task data into a pre-built asynchronous message server, wherein the asynchronous message server includes a producer, a manager and a consumer, and establishes connections between the producer and the consumer and the manager respectively.
[0048] In a preferred embodiment of the present invention, the client can be a business system of a certain trading platform, for example, the transfer system of Ping An Bank of China. Therefore, the asynchronous task data of the transfer system of Ping An Bank of China can be the transfer amount, transfer time, transfer object, etc. Among them, the asynchronous task is different from the concept of synchronous task. The synchronous task means that when a request is made to perform a certain functional task, the request cannot be returned before there is a response result. In simple terms, the request must be blocked and the next operation must be performed after a response. The asynchronous task means that when a certain functional task is executed, it is not necessary to get a response immediately before the next operation can be performed. When a response is received, the operation is processed.
[0049] Furthermore, the pre-built asynchronous message server in the present invention is constructed by RocketMQ message middleware, and the pre-built asynchronous message server includes producers, managers and consumers. Among them, the RocketMQ message middleware refers to a middleware system that can effectively guarantee and support the sending and receiving of messages through synchronous or asynchronous mechanisms in distributed application systems. The producer refers to a component that sends messages to a message queue. The manager refers to a component that processes the messages sent by the producer, and the consumer refers to a component that subscribes to the messages processed by the manager.
[0050] Furthermore, in the present invention, establishing a connection between the producer and the manager includes:
[0051] a. Open a first channel between the producer and the manager, declare a first switch through the first channel, and set relevant properties of the first switch, such as the first switch type, whether it is persistent, etc., wherein the first channel is used to identify the ID of the producer to send the message;
[0052] b. Declare a first message queue between the producer and the manager, and set relevant properties of the first message queue, such as whether it is exclusive, whether it is persistent, whether it is automatically deleted, etc.;
[0053] c. Bind the first switch and the first message queue together through a routing key. The routing key is a message forwarding method. In a preferred embodiment of the present invention, the first message queue matching the first switch is searched through the routing key. If a matching first message queue is found, the message sent from the producer is stored in the corresponding first message queue. If not found, the message is discarded and returned to the producer according to the attributes configured by the producer, and the connection is closed.
[0054] Furthermore, in the present invention, establishing a connection between the consumer and the manager includes:
[0055] A. Open a second channel between the consumer and the manager, declare a second exchanger through the second channel, and set related properties of the second exchanger, such as the type of the second exchanger and whether it is persistent, etc., wherein the second channel is used to identify the ID of the message sent by the producer;
[0056] B. Declare a second message queue between the consumer and the manager, and set relevant properties of the second message queue, such as whether it is exclusive, whether it is persistent, whether it is automatically deleted, etc.;
[0057] C. Bind the second switch and the second message queue together through a routing key. The routing key is a message forwarding method. In a preferred embodiment of the present invention, the second message queue matching the second switch is searched through the routing key. If a matching second message queue is found, the message sent from the consumer is stored in the corresponding second message queue. If not found, the message is discarded and returned to the consumer according to the attributes configured by the consumer, and the connection is closed.
[0058] S2. The producer parses and processes the asynchronous task data to obtain a message set of the asynchronous task data.
[0059] The preferred embodiment of the present invention compiles the asynchronous task data through the Java programming language, and implements the parsing process of the asynchronous task data by the producer by calling a preset Java package. In detail, the parsing process includes: the present invention calls the vesselmq-filtersrv package in Java to filter the asynchronous task data, provides operation and maintenance instructions to the user through the esselmq-tools package in Java, and adds, deletes, changes and views the filtered asynchronous data according to the needs of the user, completes the parsing process, and obtains the message set of the asynchronous task. For example, create a Topic, delete a Topic, view the routing information of a Topic, view Topic statistics, add and modify subscription group information, view consumption progress, etc.
[0060] Furthermore, the present invention also includes sending the message of the asynchronous task data according to the Transaction MQProducer interface in Java; checking the sending status of the message set of the asynchronous task data according to the Send Status class in Java; and checking the sending result of the message set of the asynchronous task data according to the Send Result class in Java.
[0061] S3. The manager aggregates and processes the message set of the asynchronous task data to obtain a source message set.
[0062] In a preferred embodiment of the present invention, the manager includes a Broker module and a Name Server module, wherein the Broker module is used to transfer, read and store messages, and the Name Server module is used to deploy message clusters, maintain information of each message node, and provide routing services for the asynchronous messenger.
[0063] Furthermore, in the present invention, based on the connection established between the producer and the manager, the message set of the asynchronous task data is transmitted to the Broker module, and the message set Topic routing information of the asynchronous task data is periodically obtained from the Name Server module, and the message set Topic routing information is parsed by the Namesrv Startup class in the Name Server module to obtain the information of each node in the message set of the asynchronous task data, and the Default Request Processor class in the Broker module is used to define the communication protocol between each node in the message set, and the respective processing information in the message set of the asynchronous task data is called according to the communication protocol, thereby completing the summary processing of the message set of the asynchronous task data and obtaining the source message set.
[0064] S4. The consumer consumes and subscribes to the source message set to obtain a target message set.
[0065] The preferred embodiment of the present invention obtains the standard data set of the source data set by presetting the source data set node address of the Name Server module in the manager and traversing the Topic and tag of the source data set. The distribution strategy includes: average distribution, consumer end configuration, etc.
[0066] Furthermore, in the present invention, the consumer periodically sends a consumption request to the manager, and the manager searches for data in the allocated consumption queue according to the consumption request to complete the consumption subscription. If there is a message in the consumption queue, the data is returned immediately. After the consumer receives the returned data, it calls back the listener in the consumer to obtain the target data set. If there is no message in the message queue, the manager will block the request until data is transmitted or timeout occurs before returning.
[0067] S5. Transmit the target message set to a background database, obtain a query result of the target message set, and return the query result to the client through the asynchronous message server.
[0068] In a preferred embodiment of the present invention, the backend database may be a backend database of Ping An Bank of China. For example, if the target message is to query whether the transfer amount of 100 has been transferred to the account of user Z, the backend database of Ping An Bank of China will perform a query operation after receiving the target message, and return the query result to the client through the asynchronous message server.
[0069] The invention also provides an asynchronous task data processing device. Figure 2FIG. 1 is a schematic diagram of the internal structure of an asynchronous task data processing device provided by an embodiment of the present invention.
[0070] In this embodiment, the asynchronous task data processing device 1 can be a PC (Personal Computer), or a terminal device such as a smart phone, a tablet computer, a portable computer, or a server, etc. The asynchronous task data processing device 1 at least includes a memory 11, a processor 12, a communication bus 13, and a network interface 14.
[0071] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of the asynchronous task data processing device 1, such as a hard disk of the asynchronous task data processing device 1. In other embodiments, the memory 11 may also be an external storage device of the asynchronous task data processing 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 (Flash Card), etc. equipped on the asynchronous task data processing device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the asynchronous task data processing device 1. The memory 11 may not only be used to store application software and various types of data installed in the asynchronous task data processing device 1, such as the code of the asynchronous task data processing program 01, etc., but may also be used to temporarily store data that has been output or is to be output.
[0072] In some embodiments, the processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor or other data processing chip, used to run program codes stored in the memory 11 or process data, such as executing an asynchronous task data processing program 01.
[0073] The communication bus 13 is used to realize the connection and communication between these components.
[0074] The network interface 14 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and is generally used to establish a communication connection between the device 1 and other electronic devices.
[0075] Optionally, the device 1 may also include a user interface, which may include a display (Display), an input unit such as a keyboard (Keyboard), and the optional user interface may also 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 OLED (Organic Light-Emitting Diode) touch device, etc. 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 asynchronous task data processing device 1 and to display a visual user interface.
[0076] Figure 2 Only the asynchronous task data processing device 1 having components 11-14 and the asynchronous task data processing program 01 is shown. It can be understood by those skilled in the art that Figure 1 The structure shown does not constitute a limitation on the asynchronous task data processing device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0077] exist Figure 2 In the embodiment of the device 1 shown, the memory 11 stores an asynchronous task data processing program 01; when the processor 12 executes the asynchronous task data processing program 01 stored in the memory 11, the following steps are implemented:
[0078] Step 1: Obtain the asynchronous task data to be processed by the client, and input the asynchronous task data into a pre-built asynchronous message server, wherein the asynchronous message server includes a producer, a manager and a consumer, and establishes connections between the producer and the consumer and the manager respectively.
[0079] In a preferred embodiment of the present invention, the client can be a business system of a certain trading platform, for example, the transfer system of Ping An Bank of China. Therefore, the asynchronous task data of the transfer system of Ping An Bank of China can be the transfer amount, transfer time, transfer object, etc. Among them, the asynchronous task is different from the concept of synchronous task. The synchronous task means that when a request is made to perform a certain functional task, the request cannot be returned before there is a response result. In simple terms, the request must be blocked and the next operation must be performed after a response. The asynchronous task means that when a certain functional task is executed, it is not necessary to get a response immediately before the next operation can be performed. When a response is received, the operation is processed.
[0080] Furthermore, the pre-built asynchronous message server in the present invention is constructed by RocketMQ message middleware, and the pre-built asynchronous message server includes producers, managers and consumers. Among them, the RocketMQ message middleware refers to a middleware system that can effectively guarantee and support the sending and receiving of messages through synchronous or asynchronous mechanisms in distributed application systems. The producer refers to a component that sends messages to a message queue. The manager refers to a component that processes the messages sent by the producer, and the consumer refers to a component that subscribes to the messages processed by the manager.
[0081] Furthermore, in the present invention, establishing a connection between the producer and the manager includes:
[0082] a. Open a first channel between the producer and the manager, declare a first switch through the first channel, and set relevant properties of the first switch, such as the first switch type, whether it is persistent, etc., wherein the first channel is used to identify the ID of the producer to send the message;
[0083] b. Declare a first message queue between the producer and the manager, and set relevant properties of the first message queue, such as whether it is exclusive, whether it is persistent, whether it is automatically deleted, etc.;
[0084] c. Bind the first switch and the first message queue together through a routing key. The routing key is a message forwarding method. In a preferred embodiment of the present invention, the first message queue matching the first switch is searched through the routing key. If a matching first message queue is found, the message sent from the producer is stored in the corresponding first message queue. If not found, the message is discarded and returned to the producer according to the attributes configured by the producer, and the connection is closed.
[0085] Furthermore, in the present invention, establishing a connection between the consumer and the manager includes:
[0086] A. Open a second channel between the consumer and the manager, declare a second exchanger through the second channel, and set related properties of the second exchanger, such as the type of the second exchanger and whether it is persistent, etc., wherein the second channel is used to identify the ID of the message sent by the producer;
[0087] B. Declare a second message queue between the consumer and the manager, and set relevant properties of the second message queue, such as whether it is exclusive, whether it is persistent, whether it is automatically deleted, etc.;
[0088] C. Bind the second switch and the second message queue together through a routing key. The routing key is a message forwarding method. In a preferred embodiment of the present invention, the second message queue matching the second switch is searched through the routing key. If a matching second message queue is found, the message sent from the consumer is stored in the corresponding second message queue. If not found, the message is discarded and returned to the consumer according to the attributes configured by the consumer, and the connection is closed.
[0089] Step 2: The producer parses and processes the asynchronous task data to obtain a message set of the asynchronous task data.
[0090] The preferred embodiment of the present invention compiles the asynchronous task data through the Java programming language, and implements the parsing process of the asynchronous task data by the producer by calling a preset Java package. In detail, the parsing process includes: the present invention calls the vesselmq-filtersrv package in Java to filter the asynchronous task data, provides operation and maintenance instructions to the user through the esselmq-tools package in Java, and adds, deletes, changes and views the filtered asynchronous data according to the needs of the user, completes the parsing process, and obtains the message set of the asynchronous task. For example, create a Topic, delete a Topic, view the routing information of a Topic, view Topic statistics, add and modify subscription group information, view consumption progress, etc.
[0091] Furthermore, the present invention also includes sending the message of the asynchronous task data according to the Transaction MQProducer interface in Java; checking the sending status of the message set of the asynchronous task data according to the Send Status class in Java; and checking the sending result of the message set of the asynchronous task data according to the Send Result class in Java.
[0092] Step three: The manager aggregates and processes the message set of the asynchronous task data to obtain a source message set.
[0093] In a preferred embodiment of the present invention, the manager includes a Broker module and a Name Server module, wherein the Broker module is used to transfer, read and store messages, and the Name Server module is used to deploy message clusters, maintain information of each message node, and provide routing services for the asynchronous messenger.
[0094] Furthermore, in the present invention, based on the connection established between the producer and the manager, the message set of the asynchronous task data is transmitted to the Broker module, and the message set Topic routing information of the asynchronous task data is periodically obtained from the Name Server module, and the message set Topic routing information is parsed by the Namesrv Startup class in the Name Server module to obtain the information of each node in the message set of the asynchronous task data, and the Default Request Processor class in the Broker module is used to define the communication protocol between each node in the message set, and the respective processing information in the message set of the asynchronous task data is called according to the communication protocol, thereby completing the summary processing of the message set of the asynchronous task data and obtaining the source message set.
[0095] Step 4: The consumer consumes and subscribes to the source message set to obtain the target message set.
[0096] The preferred embodiment of the present invention obtains the standard data set of the source data set by presetting the source data set node address of the Name Server module in the manager and traversing the Topic and tag of the source data set. The distribution strategy includes: average distribution, consumer end configuration, etc.
[0097] Furthermore, in the present invention, the consumer periodically sends a consumption request to the manager, and the manager searches for data in the allocated consumption queue according to the consumption request to complete the consumption subscription. If there is a message in the consumption queue, the data is returned immediately. After the consumer receives the returned data, it calls back the listener in the consumer to obtain the target data set. If there is no message in the message queue, the manager will block the request until data is transmitted or timeout occurs before returning.
[0098] Step 5: Transmit the target message set to a background database, obtain a query result of the target message set, and return the query result to the client through the asynchronous message server.
[0099] In a preferred embodiment of the present invention, the backend database may be a backend database of Ping An Bank of China. For example, if the target message is to query whether the transfer amount of 100 has been transferred to the account of user Z, the backend database of Ping An Bank of China will perform a query operation after receiving the target message, and return the query result to the client through the asynchronous message server.
[0100] Optionally, in other embodiments, the asynchronous task data processing program can also be divided into one or more modules, one or more modules are stored in the memory 11, and are executed by one or more processors (processor 12 in this embodiment) to complete the present invention. The module referred to in the present invention refers to a series of computer program instruction segments that can perform specific functions, and is used to describe the execution process of the asynchronous task data processing program in the asynchronous task data processing device.
[0101] For example, refer to Figure 3 FIG. 1 is a schematic diagram of a program module of an asynchronous task data processing program in an embodiment of an asynchronous task data processing device of the present invention. In this embodiment, the asynchronous task data processing program can be divided into a data receiving module 10, a data parsing module 20, a data aggregation module 30, a data consumption subscription module 40 and a data query module 50. For example:
[0102] The data receiving module 10 is used to obtain asynchronous task data to be processed by the client, and input the asynchronous task data into a pre-built asynchronous message server, wherein the asynchronous message server includes a producer, a manager and a consumer, and establishes connections between the producer and the consumer and the manager respectively.
[0103] The data parsing module 20 is used to parse the asynchronous task data through the producer to obtain a message set of the asynchronous task data.
[0104] The data aggregation module 30 is used to aggregate the message set of the asynchronous task data through the manager to obtain a source message set.
[0105] The data consumption subscription module 40 is used to: consume and subscribe to the source message set through the consumer to obtain the target message set.
[0106] The data query module 50 is used to: transmit the target message set to the background database, obtain the query result of the target message set, and return the query result to the client through the asynchronous message server.
[0107] The functions or operation steps implemented when the above-mentioned program modules such as the data receiving module 10, the data parsing module 20, the data aggregation module 30, the data consumption subscription module 40 and the data query 50 are executed are substantially the same as those in the above-mentioned embodiments and will not be repeated here.
[0108] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which an asynchronous task data processing program is stored. The asynchronous task data processing program can be executed by one or more processors to implement the following operations:
[0109] Acquire asynchronous task data to be processed by the client, and input the asynchronous task data into a pre-built asynchronous message server, wherein the asynchronous message server includes a producer, a manager, and a consumer, and establishes connections between the producer and the consumer and the manager respectively;
[0110] The producer parses the asynchronous task data to obtain a message set of the asynchronous task data;
[0111] The manager aggregates and processes the message set of the asynchronous task data to obtain a source message set;
[0112] The consumer consumes and subscribes to the source message set to obtain a target message set;
[0113] The target message set is transmitted to a background database, a query result of the target message set is obtained, and the query result is returned to the client through the asynchronous message server.
[0114] The specific implementation of the computer-readable storage medium of the present invention is basically the same as the above-mentioned embodiments of the asynchronous task data processing device and method, and will not be repeated here.
[0115] 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 in this article 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 presence of other identical elements in the process, device, article or method including the element.
[0116] 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 a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0117] 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. An asynchronous task data processing method, characterized in that: The method comprises: Acquire asynchronous task data to be processed by the client, and input the asynchronous task data into a pre-built asynchronous message server, wherein the pre-built asynchronous message server includes Rocket MQ message middleware, and the asynchronous message server includes a producer, a manager, and a consumer, open a first channel between the producer and the manager, declare a first switch through the first channel, declare a first message queue between the producer and the manager, bind the first switch and the first message queue by using a routing key, establish a connection between the producer and the manager, open a second channel between the consumer and the manager, declare a second switch through the second channel, declare a second message queue between the consumer and the manager, bind the second switch and the second message queue by using a routing key, and establish a connection between the consumer and the manager; The producer parses and processes the asynchronous task data to obtain a message set of the asynchronous task data, sends the message set to the manager, checks the sending status of the message set, and checks the sending result of the message set; The manager includes a Broker module and a Name Server module, transmits the message set of the asynchronous task data to the Broker module, and periodically obtains the message set topic routing information of the asynchronous task data from the Name Server module, parses the message set topic routing information through the Namesrv Startup class in the Name Server module, obtains the information of each node in the message set of the asynchronous task data, uses the Default Request Processor class in the Broker module to define the communication protocol between each node in the message set, calls the respective processing information in the message set of the asynchronous task data according to the communication protocol, and summarizes the message set of the asynchronous task data to obtain the source message set; The source data set node address of the Name Server module is preset, and the subject and label of the source data set are traversed to obtain the standard data set of the source data set, and the consumption queue is allocated to the standard data set according to the preset allocation strategy, and the consumer sends a consumption request to the manager regularly through the consumer, and performs data search on the consumption queue according to the consumption request, so as to complete the consumption subscription of the source message set and obtain the target message set; The target message set is transmitted to a background database, a query result of the target message set is obtained, and the query result is returned to the client through the asynchronous message server.
2. The asynchronous task data processing method according to claim 1, characterized in that: The analysis process includes: The asynchronous task data is filtered, and the filtered asynchronous task data is added, deleted, changed and viewed through operation and maintenance instructions according to user needs to complete the parsing process.
3. An asynchronous task data processing device, characterized in that: The device includes a memory and a processor, wherein the memory stores an asynchronous task data processing program that can be run on the processor, and when the asynchronous task data processing program is executed by the processor, the following steps are implemented: Acquire asynchronous task data to be processed by the client, and input the asynchronous task data into a pre-built asynchronous message server, wherein the pre-built asynchronous message server includes Rocket MQ message middleware, and the asynchronous message server includes a producer, a manager, and a consumer, open a first channel between the producer and the manager, declare a first switch through the first channel, declare a first message queue between the producer and the manager, bind the first switch and the first message queue by using a routing key, establish a connection between the producer and the manager, open a second channel between the consumer and the manager, declare a second switch through the second channel, declare a second message queue between the consumer and the manager, bind the second switch and the second message queue by using a routing key, and establish a connection between the consumer and the manager; The producer parses and processes the asynchronous task data to obtain a message set of the asynchronous task data, sends the message set to the manager, checks the sending status of the message set, and checks the sending result of the message set; The manager includes a Broker module and a Name Server module, transmits the message set of the asynchronous task data to the Broker module, and periodically obtains the message set topic routing information of the asynchronous task data from the Name Server module, parses the message set topic routing information through the Namesrv Startup class in the Name Server module, obtains the information of each node in the message set of the asynchronous task data, uses the Default Request Processor class in the Broker module to define the communication protocol between each node in the message set, calls the respective processing information in the message set of the asynchronous task data according to the communication protocol, and summarizes the message set of the asynchronous task data to obtain the source message set; The source data set node address of the Name Server module is preset, and the subject and label of the source data set are traversed to obtain the standard data set of the source data set, and the consumption queue is allocated to the standard data set according to the preset allocation strategy, and the consumer sends a consumption request to the manager regularly through the consumer, and performs data search on the consumption queue according to the consumption request, so as to complete the consumption subscription of the source message set and obtain the target message set; The target message set is transmitted to a background database, a query result of the target message set is obtained, and the query result is returned to the client through the asynchronous message server.
4. The asynchronous task data processing device according to claim 3, characterized in that: The analysis process includes: The asynchronous task data is filtered, and the filtered asynchronous task data is added, deleted, changed and viewed through operation and maintenance instructions according to user needs to complete the parsing process.
5. A computer-readable storage medium, characterized in that: An asynchronous task data processing program is stored on the computer-readable storage medium, and the asynchronous task data processing program can be executed by one or more processors to implement the steps of the asynchronous task data processing method as described in any one of claims 1 to 2.
Citation Information
Cited By
Multi-agent task data processing method and system
CN122548673A
A multi-agent task data processing method and system
CN122548673B
